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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to