Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

-Wfloat-equal not always recognized #35035

Open Quuxplusone opened 6 years ago

Quuxplusone commented 6 years ago
Bugzilla Link PR36062
Status NEW
Importance P enhancement
Reported by Arvid Gerstmann (ag@arvid.io)
Reported on 2018-01-23 08:55:45 -0800
Last modified on 2019-05-09 01:43:16 -0700
Version trunk
Hardware PC Windows NT
CC llvm-bugs@lists.llvm.org
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also

The following is not issuing the '-Wfloat-equal' warning: (x + y) != 0.0f. If 0.0f is changed into 0, it's issued. This seems to be somewhat related to https://bugs.llvm.org/show_bug.cgi?id=23717. While I agree with the rationale presented in the previously linked ticket, comparing to zero after an operation is still potentially unsafe.

Quuxplusone commented 5 years ago

Compiler Explorer test case: https://gcc.godbolt.org/z/BH72zZ