Compiling optimized release build with debug info turns off optimizations?

David Nadlinger code at
Mon Dec 23 07:15:54 PST 2013

On Saturday, 21 December 2013 at 12:17:57 UTC, Mikko Ronkainen 
> Now if I add -g to an optimized build (-O3 -release) in LDC, it 
> seems that all/some optimizations are turned off. The debug 
> (-g) and profile (-O3 -release -g) builds have the same 
> performance. Release (-O3 -release) is noticeably faster.

The issue is that currently -g links in a non-optimized build of 
druntime/Phobos, which is probably not a good idea:

I'm currently thinking about enabling the druntime/Phobos debug 
libraries when -d-debug is given (which also enables debug {} 
blocks), but if you have a better idea, please comment on the 
above GitHub issue.


More information about the digitalmars-d-ldc mailing list