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

Mike Stump mrs at apple.com
Thu Dec 17 14:10:17 PST 2009


On Dec 17, 2009, at 12:09 PM, Chris Lattner wrote:
> 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.

I'm referring to the specification of the feature and the behavior of gcc.  In those two cases, yes, it does work.  llvm-gcc has a bug, that could be fixed, and if it were fixed, then its behavior would match gcc, and then in llvm-gcc it would also work.

>>> it's pure luck.
>> 
>> I'd call it careful engineering.
> 
> If you look at the IR generated by llvm-gcc,

llvm-gcc is buggy.

> there is nothing that prevents the compiler from clobbering EAX after the asm.




More information about the cfe-commits mailing list