[LLVMbugs] [Bug 15314] New: Analyzer misses potential null dereference

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Feb 20 10:16:55 PST 2013


            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: kremenek at apple.com
          Reporter: jim.correia at pobox.com
                CC: llvmbugs at cs.uiuc.edu
    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


  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
     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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130220/e9f3105a/attachment.html>

More information about the llvm-bugs mailing list