-
Notifications
You must be signed in to change notification settings - Fork 15k
Closed
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillaclang:static analyzerduplicateResolved as duplicateResolved as duplicate
Description
| Bugzilla Link | 4173 |
| Resolution | DUPLICATE |
| Resolved on | Feb 22, 2010 12:55 |
| Version | unspecified |
| OS | Linux |
| Reporter | LLVM Bugzilla Contributor |
| CC | @tkremenek,@xuzhongxing |
Extended Description
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;
}
}
}
Metadata
Metadata
Assignees
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillaclang:static analyzerduplicateResolved as duplicateResolved as duplicate