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

Johan Engelen via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Sat Jul 9 01:28:22 PDT 2016


On Friday, 8 July 2016 at 20:55:50 UTC, David Nadlinger wrote:
> 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.

Every now and then, the need to remove NDEBUG dependency in 
headers pops up on the LLVM maillist. I don't think it's solved 
yet.

> 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)

Yeah, I think this is the solution. I'm going to try with a 
Release build of LLVM with assertions explicitly enabled.

  We have to keep in mind that none of the Linux builds are with 
assertions enabled!


More information about the digitalmars-d-ldc mailing list