[llvm-bugs] [Bug 38331] New: -Wfloat-equal does not catch comparision with constant value

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jul 26 10:51:56 PDT 2018


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

            Bug ID: 38331
           Summary: -Wfloat-equal does not catch comparision with constant
                    value
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Static Analyzer
          Assignee: dcoughlin at apple.com
          Reporter: david.bolvansky at gmail.com
                CC: llvm-bugs at lists.llvm.org

Code compiled with -Wfloat-equal:
bool compare (const float lhs, const float rhs)
{
  return lhs == rhs; // Clang warns
}

bool compare2 (const float lhs, const float rhs)
{
  return lhs == 1.0; // No warning from Clang, GCC warns
}

-- 
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/20180726/5bc7ec9a/attachment.html>


More information about the llvm-bugs mailing list