<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 --- - new[]/delete mismatch"
   href="http://llvm.org/bugs/show_bug.cgi?id=19948">19948</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>new[]/delete mismatch
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libc++
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </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>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>antognini.marco@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu, mclow.lists@gmail.com
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>While discovering a bug in cpputest [1] it seems there is another bug but in
libc++ this time.

Throwing a `std::runtime_error` or a `std::logic_error` results in an
allocation/deallocation type mismatch.

According to the standard it's UB to free with `delete` a memory portion
allocated with `new[]`.

The full code is available at [1] but I suspect the relevant instructions being
only:

throw std::runtime_error("foo");


NB: I've installed llvm with clang and related tools with homebrew on Mac. [2]
show the complete procedure I used (since there are bugs in homebrew formula
too).

Let me know if you needs more information.

[1] <a href="https://github.com/cpputest/cpputest/issues/302">https://github.com/cpputest/cpputest/issues/302</a>
[2]
<a href="https://github.com/Homebrew/homebrew-versions/issues/340#issuecomment-44869424">https://github.com/Homebrew/homebrew-versions/issues/340#issuecomment-44869424</a></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>