Bug 106930

Summary: Internal compiler error in instantiate_virtual_regs_1
Product: [Retired] Red Hat Linux Reporter: John Riggs <jdr46>
Component: gccAssignee: Jakub Jelinek <jakub>
Status: CLOSED WONTFIX QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 9   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-10-13 18:41:38 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description John Riggs 2003-10-13 18:34:55 UTC
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 18:41:38 UTC
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 18:59:11 UTC
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.