https://bugs.llvm.org/show_bug.cgi?id=51775
Bug ID: 51775
Summary: -ffast-math breaks strtod() due to "== HUGE_VAL"
considered impossible
Product: clang
Version: 12.0
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected],
[email protected]
Created attachment 25236
--> https://bugs.llvm.org/attachment.cgi?id=25236&action=edit
Test aimed to reproduce the -ffast-math comparison bug
This is a regression from clang-11 to clang-12, but could be considered normal
if we consider -ffast-math as being "by design" unreliable w.r.t comparisons.
However, this breaks the use of functions such as strtod(), which can be
considered a more serious issue, because the "== HUGE_VAL" comparison is
considered by the compiler impossible and statically optimized as false
The attached program demonstrates the issue:
$ clang-11 -O1 -ffast-math
/tmp/ffast-math-strtod-overflow-condition-misoptimization-bug.c -o bug && ./bug
bad value
$ clang-12 -O1 -ffast-math
/tmp/ffast-math-strtod-overflow-condition-misoptimization-bug.c -o bug && ./bug
good value: inf
Clang versions 12 and above now are not seeing HUGE_VAL anymore
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs