[llvm-bugs] [Bug 44131] New: DenseMap segfaults due to (de)allocate_buffer incompatibility with C++17 host application.

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Nov 24 13:11:01 PST 2019


https://bugs.llvm.org/show_bug.cgi?id=44131

            Bug ID: 44131
           Summary: DenseMap segfaults due to (de)allocate_buffer
                    incompatibility with C++17 host application.
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: Support Libraries
          Assignee: unassignedbugs at nondot.org
          Reporter: jcmac at machiel.info
                CC: llvm-bugs at lists.llvm.org

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20191124/c2974abc/attachment.html>


More information about the llvm-bugs mailing list