http://llvm.org/bugs/show_bug.cgi?id=15314
Bug ID: 15314
Summary: Analyzer misses potential null dereference
Product: clang
Version: 3.2
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Static Analyzer
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Classification: Unclassified
Created attachment 10049
--> http://llvm.org/bugs/attachment.cgi?id=10049&action=edit
Sample code which demonstrates the bug.
In the attached sample, the incorrect if on line 52 in -doSomethingElse:
confuses the analyzer. It misses the potential null dereference on line 52,
line 53, and line 59.
===
Build command:
xcrun clang analyzer-null-dereference.m -fobjc-arc --analyze
Details:
Expect 2 "Potential null dereference" warnings to be generated for the
-doSomethingElse: method. None are generated. The erroneous
`if (*error != NULL)` seems to be confusing the analyzer.
Warnings generated:
analyzer-null-dereference.m:45:12: warning: Potential null dereference.
According to coding standards in 'Creating and Returning NSError Objects' the
parameter '' may be null
*error = [NSError errorWithDomain:@"MyErrorDomain" code:1
userInfo:nil];
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
(I hit this in production code — this isn't a contrived example.)
Compiler version:
% xcrun clang -v
Apple LLVM version 4.2 (clang-425.0.24) (based on LLVM 3.2svn)
Target: x86_64-apple-darwin12.2.1
Thread model: posix
--
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