Bug 106930 - Internal compiler error in instantiate_virtual_regs_1
Summary: Internal compiler error in instantiate_virtual_regs_1
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc
Version: 9
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: David Lawrence
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-10-13 18:34 UTC by John Riggs
Modified: 2007-04-18 16:58 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2003-10-13 18:41:38 UTC
Embargoed:


Attachments (Terms of Use)

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.


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