<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 --- - False positive - std::vector<T>::size() won't change in two subsequent invocations"
   href="http://llvm.org/bugs/show_bug.cgi?id=21789">21789</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>False positive - std::vector<T>::size() won't change in two subsequent invocations
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>3.5
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </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>frerich.raabe+llvmbug@gmail.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=13443" name="attach_13443" title="Tiny testcase to trigger the issue">attachment 13443</a> <a href="attachment.cgi?id=13443&action=edit" title="Tiny testcase to trigger the issue">[details]</a></span>
Tiny testcase to trigger the issue

Using 'Debian clang version 3.5.0-1~exp1 (trunk) (based on LLVM 3.5.0)' on the
attached program will emit a 'running scan-build on the following program will
emit a warning saying

foo.cpp:13:16: warning: Dereference of undefined pointer value
        (void)(*x + 1);

It appears this is because the analyzer doesn't see that two subsequent
invocations of std::vector<T>::size() will yield the same value, i.e. if the
second if() was hit then the first one must've been hit as well. I suspect this
could be considered a defect since the compiler most certainly saw the
implementation of size()?</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>