Bug 106930 - Internal compiler error in instantiate_virtual_regs_1
Internal compiler error in instantiate_virtual_regs_1
Status: CLOSED WONTFIX
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
9
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
David Lawrence
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-10-13 14:34 EDT by John Riggs
Modified: 2007-04-18 12:58 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2003-10-13 14:41:38 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description John Riggs 2003-10-13 14:34:55 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20030225

Description of problem:
I'm trying to learn inline asm with gcc. I have an internal compiler error when
compiling an example on a webpage. Crash happens with the following code:

#include <stdio.h>
int main()
{
 int foo=10, bar=15;

 asm volatile ("addl %%eax,%%ebx"
               : "=eax"(foo)
               : "eax"(foo), "ebx"(bar)
               : "eax"
               );
 printf ("foo+bar=%d\n", foo);
 return 0;
}

Version-Release number of selected component (if applicable):
gcc-3.2.2-5

How reproducible:
Always

Steps to Reproduce:
1.gcc -o hello2 hello.c
2.
3.
    

Actual Results:  Internal Compiler Error

Expected Results:  Code gets compiled

Additional info:

[root@localhost hello]# gcc -o hello2 hello.c
hello.c: In function `main':
hello.c:38: Internal compiler error in instantiate_virtual_regs_1, at
function.c:3971
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugzilla.redhat.com/bugzilla/> for instructions.
Comment 1 Jakub Jelinek 2003-10-13 14:41:38 EDT
That is very buggy testcase.
 asm volatile ("addl %1,%0"
               : "=a"(foo)
               : "0"(foo), "b"(bar)
               );
is what you meant?
1) input/output letters are names of register classes, not register names (though ia32 backend has some single register classes)
2) if you have some particural register for input/output, you shouldn't certainly have it in clobbers
3) you got the order of arguments in addl wrong
4) you should use numerical references to output regs if you want the same in inputs
   (or + constraint)
Comment 2 John Riggs 2003-10-13 14:59:11 EDT
Thanks for the info.
I got the code from http://linuxassembly.org/articles/linasm.html
The site purports to be an inline assembly tutorial. I guess it's not that good.
I would expect a compiler error message, rather than a crash.

Note You need to log in before you can comment on or make changes to this bug.