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: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


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

Reply via email to