[cfe-commits] r91073 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/Sema/return.c

Chris Lattner clattner at apple.com
Thu Dec 17 12:09:58 PST 2009


On Dec 11, 2009, at 12:28 PM, Mike Stump wrote:

> On Dec 10, 2009, at 7:37 PM, Eli Friedman wrote:
>>> It is annoying when
>>> 
>>> int foo() {
>>> asm xor eax, eax
>>> }
>>> 
>>> gives a warning.
>> 
>> If that actually works,
> 
> Yes, that works.

No it doesn't.  It happens to get lucky in many cases, but it doesn't work.

>> it's pure luck.
> 
> I'd call it careful engineering.

If you look at the IR generated by llvm-gcc, there is nothing that prevents the compiler from clobbering EAX after the asm.  There is nothing 'careful' about this.

Please revert r91073.

>>> Bear in mind, gcc's policy for:
>>> 
>>> asm int foo() {
>>> xor eax, eax
>>> }
>>> 
>>> is to _not_ give the warning.
>> 
>> Yes; we should follow gcc's lead here.
> 
> :-)

Whole function asm blocks are a completely different thing.  Your patch is wrong, please revert it.

-Chris



More information about the cfe-commits mailing list