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.
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)
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.