[LLVMbugs] [Bug 23717] New: -Wfloat-equal issued too much

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jun 1 02:16:58 PDT 2015


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

            Bug ID: 23717
           Summary: -Wfloat-equal issued too much
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: javier_3 at runbox.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The code at SemaChecking.cpp, function Sema::CheckFloatComparison, issues the
warning warn_floatingpoint_eq (-Wfloat-equal) in case of using == or != with
floating point operands, but prevents the issuing of the warning in some
special cases, among which:

  // Special case: check for comparisons against literals that can be exactly
  //  represented by APFloat.

So if the code reads if(x==0.0F) no warning is issued, but if the user simply
writes if(x==0) the warning is issued.

Given that both pieces of code get translated to exactly the same and the user
obviously knows what he is doing when writing if(x==0), my point is that in the
second case the warning should not be issued too.

I get dozens of annoying warning because of comparisons against zero, but I
don't want to turn off that warning because I think it's really meaningful in
the other cases, e.g. if(x==y).

-- 
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/20150601/af308b38/attachment.html>


More information about the llvm-bugs mailing list