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

Eli Friedman eli.friedman at gmail.com
Fri Dec 11 12:56:46 PST 2009


On Fri, Dec 11, 2009 at 12:28 PM, Mike Stump <mrs at apple.com> 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.
>
>> it's pure luck.
>
> I'd call it careful engineering.
>
>> gcc warns because it's dangerous, no?
>
> No, because I merely hadn't gotten around to fixing that bug yet.

Okay... in terms of "actually works", where exactly do you draw the
line?  How about:
int foo(int x) {
  if (x)
    asm xor eax, eax
  else
    asm xor eax, eax
  }
}

Or:
int foo(int x) {
  int i;
  asm xor eax, eax
  for (i = 0; i < x; i++)
    asm imul eax, i
}
?

Anyway, none of this is relevant to gcc-style asm blocks.

-Eli




More information about the cfe-commits mailing list