<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Possible false NULL dereference warning in doubly-linked list"
   href="http://llvm.org/bugs/show_bug.cgi?id=16782">16782</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Possible false NULL dereference warning in doubly-linked list
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Static Analyzer
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>kremenek@apple.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>bugzilla@jwwalker.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=10977" name="attach_10977" title="C++ source and header">attachment 10977</a> <a href="attachment.cgi?id=10977&action=edit" title="C++ source and header">[details]</a></span>
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 <<a href="http://sourceforge.net/projects/micropather/">http://sourceforge.net/projects/micropather/</a>>.  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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>