lua-users home
lua-l archive

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


On May 6, 2013, at 4:25 AM, steve donovan wrote:

> On Mon, May 6, 2013 at 10:12 AM, steve donovan <steve.j.donovan@gmail.com> wrote:
> 
> Besides I had exactly the same symptoms with Ubuntu clang.
> 
> I can confirm that the asm(""); trick does indeed make luabuild pass all its tests with clang on Ubuntu 32-bit - but then the check _is_ against __clang__ itself.

Fascinating. 2013-04 Apple clang on 10.7 doesn't seem to have the problem. (Yes, I scratch-installed a box to check the situation out. I'm not sure what that says about me.)

$ cc -v -m32
Apple LLVM version 4.2 (clang-425.0.28) (based on LLVM 3.2svn)
Target: i386-apple-darwin11.4.2
Thread model: posix
$ 

This is why I was targeting llvm-gcc with that preprocessor conditional. I am not certain what the semantics of asm("") are in clang anyway, so from my point of view limiting it to true gcc dialects was necessary. If clang is showing the bug then think of it as:

#ifndef __clang__
  asm("");
#else
  SOME_CLANG_HACK
#endif

but you've apparently discovered that SOME_CLANG_HACK is also asm("");....

Given this code is not exactly on the critical path, broadening the ifdef to __llvm__ doesn't sound so bad to me. Ideally at some point in the future all the clangs will have this bug fixed, and I don't want the source code to lose track of the idea that this is a hack for specific broken compilers, not a general failing of LLVM, But everybody has to claim to be gcc these days, so it's a little painful to conditionalize.

> It is a nice fast compiler, I will grant you that...

[joking]: incorrect programs can be made arbitrarily fast

Jay