[LLVMbugs] [Bug 15870] New: Xcode 4.6 static analyzer false positive calling non-virtual C++ methods on NULL pointers where method implementation provides NULL check

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Apr 30 09:21:29 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=15870

            Bug ID: 15870
           Summary: Xcode 4.6 static analyzer false positive calling
                    non-virtual C++ methods on NULL pointers where method
                    implementation provides NULL check
           Product: clang
           Version: unspecified
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: kremenek at apple.com
          Reporter: rob at ragfield.name
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Run the following code through the Xcode 4.6.2 static analyzer:


#include <iostream>
#include <math.h>

class FooBar
{
public:
    void method() { std::cout << "this is " << (this ? "NOT NULL" : "NULL") <<
"\n"; }
};

int main(int argc, const char * argv[])
{
    FooBar* foo = NULL;
    foo->method();
    return 0;
}


It produces the following issue:

FooBar/main.cpp:21:2: Called C++ object pointer is null

even though the code works fine.  My large project has this issue flagged
hundreds of times, making the static analyzer not as useful to me as it used to
be.

-- 
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/20130430/8ffb5b40/attachment.html>


More information about the llvm-bugs mailing list