[cfe-commits] r91073 - in /cfe/trunk: lib/Sema/SemaDecl.cpp test/Sema/return.c
Chris Lattner
clattner at apple.com
Thu Dec 10 17:59:02 PST 2009
On Dec 10, 2009, at 5:42 PM, Mike Stump wrote:
> On Dec 10, 2009, at 4:08 PM, Chris Lattner wrote:
>> On Dec 10, 2009, at 2:57 PM, Mike Stump wrote:
>>
>>> Author: mrs
>>> Date: Thu Dec 10 16:57:48 2009
>>> New Revision: 91073
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=91073&view=rev
>>> Log:
>>> Don't complain about falling off the end of a function with an asm
>>> block, if the function is supposed to return a value as we don't know
>>> exactly what the asm code does.
>>
>> Why?
>
> Because people write code like:
>
> void* t4(void) { __asm mov eax, fs:[0x10] }
That is not gnu asm syntax. Also, you're not fixing the right thing here. Several issues:
1. Setting eax is guaranteed to set the return value, the compiler could clobber it after the asm.
2. The bigger issue is that you're *changing the CFG* to avoid a *data* issue.
In either case, your code is not right.
>> A fix to silence the warning is to use __builtin_unreachable() after the asm.
>
> But that point is reachable.
Then why are you changing the CFG?
>
> Also, int foo() { asm("a: jump a"); } doesn't fall off the end. Essentially, trying to understand what is inside the asm is a dangerous thing.
You're right, which is why we should follow gcc's policy of assuming it can fall through!
-Chris
More information about the cfe-commits
mailing list