default behavior or

Hi Devs,
going by this link
it says that floating point operation does not have side effects by defaults.
but when compile a test case
cat a.c
float foo(float a, float b)
return a+b;

$clang a.c -O2 -S -emit-llvm
emit ir like:
$cat a.ll

I believe support for trapping math is experimental/work in progress:

looks like experimental/work in progress support:

cced the author.

Here is problematic code:

if TrappingMath is false it should set “-fno-trapping-math”,but it isn’t because there is another else if.

it should be changed to

if (TrappingMath) {
// FP Exception Behavior is also set to strict
} else

any thoughts?


Hi Kamlesh,

I haven't looked in a few months, but IINM, -trapping-math is a no-op
in LLVM. But yes, what you found is confusing and should be sorted

The front end currently generates experimental constrained intrinsics
if -ftrapping-math is present on the command line. If you want to
generate trap-safe code, you could try that option or
-ffp-model/-ffp-exception-behavior depending on your needs.