[cfe-users] optimizations that raise the FP exception flag

Peter van Hoof p.vanhoof at oma.be
Wed Jun 5 04:21:17 PDT 2013


I wonder if clang++ allows optimizations that could raise the FP 
exception flag in its default setup? For our code this would be a 
problem since we trap certain FP exceptions. Hence such optimizations 
would lead to a crash of the code. We have seen this happening with this 
version of clang++

$ clang++ --version
clang version 3.3 (trunk 179781)
Target: i386-pc-linux-gnu
Thread model: posix

If such optimizations are allowed, we need a way to disable them. Gcc 
has the -ftrapping-math flag to achieve this. Clang++ seems to accept 
this flag, but it didn't have any effect in the case we studied. Would 
this be the correct way to disable such optimizations?



Peter van Hoof
Royal Observatory of Belgium
Ringlaan 3
1180 Brussel

More information about the cfe-users mailing list