http://llvm.org/bugs/show_bug.cgi?id=16782

            Bug ID: 16782
           Summary: Possible false NULL dereference warning in
                    doubly-linked list
           Product: clang
           Version: trunk
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

Created attachment 10977
  --> http://llvm.org/bugs/attachment.cgi?id=10977&action=edit
C++ source and header

Overview:

The static analyzer says that in traversing a doubly linked list, a NULL
pointer can be dereferenced, but I can't see how that can happen.


Steps to reproduce:

Analyze the attached source, like:

  clang -DDEBUG=1 --analyze micropather.cpp


Actual results:

micropather.h:206:45: warning: Access to field 'next' results in a dereference
of a null pointer (loaded from variable 'it'


Expected results:

No warning.


Build date:

clang version 3.4 (trunk 187678)
Target: x86_64-apple-darwin11.4.2
Thread model: posix


Additional information:

The code is from <http://sourceforge.net/projects/micropather/>.  I don't claim
to be intimately familiar with it.  But it appears to me that the next and prev
pointers only become NULL when a node is removed from the doubly linked list,
so traversing the list should not encounter a NULL.

-- 
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

Reply via email to