[LLVMbugs] [Bug 15108] New: False positive: floating point comparisons

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jan 29 09:06:41 PST 2013


             Bug #: 15108
           Summary: False positive: floating point comparisons
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Static Analyzer
        AssignedTo: kremenek at apple.com
        ReportedBy: will at willglynn.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 9940
  --> http://llvm.org/bugs/attachment.cgi?id=9940
Test case

I upgraded to XCode 4.6 (4H127) and noticed static analyzer false positives
relating to floating point comparisons. I've boiled this behavior down to the
attached test case.

The real-world code inspiring this test case is admittedly gross, but I believe
it to be correct: if a floating point value does not equal a constant in one
expression, it will still not equal that constant in a subsequent expression.
In other words, I believe floating-point comparisons to be deterministic, but
the static analyzer appears to believe otherwise.

$ ccc-analyzer -v
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.11~148/src/configure
--disable-checking --enable-werror
--mandir=/share/man --enable-languages=c,objc,c++,obj-c++
--program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/
--with-slibdir=/usr/lib --build=i686-apple-darwin11
--program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11
--target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
$ clang -v
clang version 3.0 (tags/RELEASE_30/final)
Target: x86_64-apple-darwin12.2.0
Thread model: posix

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list