[LLVMbugs] [Bug 6912] New: Spurious null pointer dereference warning
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri Apr 23 18:23:21 PDT 2010
http://llvm.org/bugs/show_bug.cgi?id=6912
Summary: Spurious null pointer dereference warning
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: Static Analyzer
AssignedTo: kremenek at apple.com
ReportedBy: evan at chromium.org
CC: llvmbugs at cs.uiuc.edu
I just tried out scan-build on a large project and reduced many of the spurious
warnings to the attached simple test case.
The pattern is that there's a global variable along with a function that may
initialize it, and anyone who uses it tests either that the variable has been
initialized or that the initialization function succeeds. So we always either
return or have the variable end up initialized.
This code is kind of crazy, I agree, but it's a real open source library (NSS,
from http://www.mozilla.org/projects/security/pki/nss/) that does this.
The error message is as follows:
crazy.c:19:18: warning: Dereference of null pointer (loaded from variable
'global_p')
printf("%d\n", *global_p);
--
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