<html>
    <head>
      <base href="https://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 --- - Failure to find double delete" href="https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D24170&d=AwMBaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=pF93YEPyB-J_PERP4DUZOJDzFVX5ZQ57vQk33wu0vio&m=L_5hbdmwH7sFL7wev5zkSCDVVHYYyIGqFY4LNpAkf6A&s=5BlW70WiYCF8DDsCmF0wrEWcCjYIIjQtaeEF7G4enI8&e=">24170</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Failure to find double delete
          </td>
        </tr>

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

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

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

        <tr>
          <th>OS</th>
          <td>Linux
          </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>vabanque@gmx.net
          </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=14604" name="attach_14604" title="shows correctly detected error">attachment 14604</a> <a href="attachment.cgi?id=14604&action=edit" title="shows correctly detected error">[details]</a></span>
shows correctly detected error

file1.cpp shows that the analyzer can detect a double delete caused by an
incorrect copy constructor.

$ scan_build clang++ file1.cpp 
scan-build: Using 'clang/bin/clang' for static analysis
file1.cpp:9:9: warning: Attempt to free released memory
        delete [] data;
        ^~~~~~~~~~~~~~


file2.cpp shows how the analyzer fails to detect a similar mistake in a copy
assignment operator.

$ scan_build clang++ file2.cpp 
scan-build: Using '/clang/bin/clang' for static analysis
scan-build: Removing directory '/tmp/scan-build-2015-07-17-211038-16264-1'
because it contains no reports.
scan-build: No bugs found

$ clang -v
clang version 3.8.0 (trunk 242502)
Target: x86_64-unknown-linux-gnu
Thread model: posix
Found candidate GCC installation:
gcc4.9.2/lib/gcc/x86_64-unknown-linux-gnu/4.9.2
Found candidate GCC installation:
gcc4.9.2/lib64/gcc/x86_64-unknown-linux-gnu/4.9.2
Selected GCC installation: gcc4.9.2/lib64/gcc/x86_64-unknown-linux-gnu/4.9.2
Candidate multilib: .;@m64
Selected multilib: .;@m64</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>