[llvm-bugs] [Bug 49212] New: Clang should warn when std::isinf is compiled with -ffast-math

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Feb 16 14:32:54 PST 2021


https://bugs.llvm.org/show_bug.cgi?id=49212

            Bug ID: 49212
           Summary: Clang should warn when std::isinf is compiled with
                    -ffast-math
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: bmoses at google.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

When -ffast-math is enabled, Clang can optimize away calls to std::isinf (and
similar functions such as std::isnan) in ways that may be surprising.  As one
of my colleagues said, "I thought -ffast-math only affected stuff like
reordering operations in mathematically-but-not-numerically-equivalent ways and
wouldn't affect stuff like isinf or isnan."

Can we add a warning for the case where std::isinf and similar functions are
invoked in code compiled with -ffast-math?

This warning would also likely have made the confusing interaction of options
in bug 33510 immediately obvious, rather than requiring the user to notice that
their NaN handling wasn't working as expected.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210216/04583a1e/attachment.html>


More information about the llvm-bugs mailing list