[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#153472: G++ 3.1.1 incorrectly handles clobbered registers in "asm volatile ()"



"Nikita V. Youshchenko" <yoush@cs.msu.su> writes:

> "asm" statement here clobbers %ebx register. And it tells the compiler 
> after the third semicolon that %ebx is clobbered, so compiler should not 
> depend on any value stored there.

Notice that this really is a bug in your program. In PIC code, ebx is
reserved as the PIC register, and cannot be used for anything.

You should really declare ebx as an output register here; if you do
so, g++ 2.95 will report

t.cpp:16: Invalid `asm' statement:
t.cpp:16: fixed or forbidden register 3 (bx) was spilled for class BREG.

and g++ 3.1 will report

t.cpp:16: error: can't find a register in class `BREG' while reloading `asm'

So if there is any bug in the compiler, it is that it doesn't reject
your code. This bug has been reported as

http://gcc.gnu.org/ml/gcc-bugs/2001-08/msg00856.html

Regards,
Martin



-- 
To UNSUBSCRIBE, email to debian-gcc-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: