[LLVMbugs] [Bug 11994] New: false positive: deregerence of null pointer.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Feb 13 05:13:04 PST 2012


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

             Bug #: 11994
           Summary: false positive: deregerence of null pointer.
           Product: clang
           Version: 3.0
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
        AssignedTo: kremenek at apple.com
        ReportedBy: pluto at agmk.net
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


int& singleton();
void foo();
void bar( int x )
{
        int& a = singleton();
        int& b = singleton();
        if ( &a == 0 )
                foo();
        a = 5;
        if ( b != 5 )
                foo();
}


$ clang --analyze 0.cpp
0.cpp:9:2: warning: Dereference of null pointer
        a = 5;
        ^

of course in c++ the address of reference can't be a null pointer.

-- 
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