Asserts in C++ code not working for debug builds?

David Nadlinger via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Fri Jul 8 13:55:50 PDT 2016


On 8 Jul 2016, at 21:10, Johan Engelen via digitalmars-d-ldc wrote:
> What's wrong with my setup? I am compiling LDC in debug mode, but I am 
> using a release-mode LLVM (speed...). This means llvm-config will 
> return "-DNDEBUG" as one of the --cxxflags, and all my asserts are 
> disabled. (It also sets "-O3" for the LDC build)
>
> Advice?

IIRC, the LLVM ABI changes depending on whether (N)DEBUG is enabled when 
including the headers, which has actually led to hard to debug issues in 
the past.

A Google or Git history search will probably turn up the exact places it 
does. Assuming you want to disable the LLVM assertions for speed and not 
just have an optimised build (which would of course easily be possible), 
you would need to look into whether there is a way (a preprocessor flag 
separate from NDEBUG, etc.) to keep the ABI the same as for debug builds 
while eliding assertions.

  — David


More information about the digitalmars-d-ldc mailing list