<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - DenseMap segfaults due to (de)allocate_buffer incompatibility with C++17 host application."
   href="https://bugs.llvm.org/show_bug.cgi?id=44131">44131</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>DenseMap segfaults due to (de)allocate_buffer incompatibility with C++17 host application.
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </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>release blocker
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>Support Libraries
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>jcmac@machiel.info
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I have a C++17 Windows/MSVC host application that uses the llvm libraries
compiled with C++14. My application segfaults when running a release build due
to how allocate_buffer and deallocate_buffer are implemented.
In those functions, #ifdef __cpp_aligned_new is used to test for the
aligned_new feature which is present in C++17 but not in C++14. Because these
functions are defined in a header file (Compiler.h) this will introduce an
incompatibility when buffers are allocated by some llvm function and freed by
some function that eventually calls deallocate_buffer from my host application.
Buffers will be allocated without a specific alignment and then potentially
de-allocated with the aligned version of operator delete or vice versa.

Commenting those #ifdefs out fixes it for me.

Those function should either be implemented in a .cpp file or those #ifdefs
should use some #define that is defined at llvm library compile time instead of
using __cpp_aligned_new.</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>