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: unassignedb...@nondot.org
          Reporter: jc...@machiel.info
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to