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