[LLVMbugs] [Bug 4173] New: false positive: Dereference of null pointer

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Thu May 7 07:43:36 PDT 2009


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

           Summary: false positive: Dereference of null pointer
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: dimhen at gmail.com
                CC: llvmbugs at cs.uiuc.edu


scan-build gcc -Wall -O3 -c tst1.c

produce

ANALYZE: tst1.c foo
tst1.c:21:10: warning: Dereference of null pointer
            pB->n = 0;
            ~~~~^
1 diagnostic generated.
scan-build: 1 bugs found.

cat tst1.c
#include <stdio.h>

struct blob {
    int n;
    void *p;
};

extern void bar(FILE**);

void foo(int x, int *y)
{
    struct blob *pB = NULL;

    if( !(x & 0x16) )
        bar((FILE**) (void*)&pB);

    if( !(x & 0x16) ) {
        if(*y==0) {
            *y = 5;
        } else {
            pB->n = 0;
        }
    }
}


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