I'm using a new version of Clang from Apple, targeting macOS 10.12, which comes 
from an Xcode that is still in beta. I'm compiling C code, rather than C++.

I'm hitting problems with the compiler assuming that floating-point divides 
won't trap, and executing them speculatively, in advance of the conditions that 
prevent the traps going off. Previous versions of Clang didn't do this, but 
it's causing me difficulties, because the product I work on is tested with 
Overflow, Invalid and Divide-by-zero traps enabled: this makes it much easier 
to find problems than by tracing back through lots of NaNs.

I can't find anything that seems relevant in the Clang user's manual at 
http://clang.llvm.org/docs/UsersManual.html.

The GCC 4.2 documentation has three options that look possibly relevant. 
-ftrapping-math and -fnon-call-exceptions are accepted by Clang, but don't seem 
to make any difference to the problematic source; -fsignaling-nans is not 
supported by Clang, and the message is quite clear about that.

Turning optimisation right off with -O0 suppresses the problem, but is really 
bad for performance: we've been able to build and work effectively at -O2 for 
several years with Apple's Clang releases.

Am I missing an option somewhere, or does this look like a bug that I need to 
report?

thanks,

--
John Dallman

-----------------
Siemens Industry Software Limited is a limited company registered in England 
and Wales.
Registered number: 3476850.
Registered office: Faraday House, Sir William Siemens Square, Frimley, Surrey, 
GU16 8QD.
_______________________________________________
cfe-users mailing list
cfe-users@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users

Reply via email to