Segfault with DMD optimization switch

Jonathan M Davis jmdavisProg at gmx.com
Tue Jan 22 21:54:30 PST 2013


On Wednesday, January 23, 2013 06:39:02 Rob T wrote:
> I encountered a segfault once after compiling with -O -release.
> It was the -release that caused an assert to be removed from a
> function that did not return due to an error condition. When the
> error was encountered there was no longer an assert to catch it,
> resulting in a segfault.

assert(0) is put at the end of functions in case the end of the function is 
reached without returning, and unlike normal assertions, assert(0) is left in 
in release mode, except it becomes a halt instruction, which be pretty much 
the same thing as a segfault. So, it sounds like you ran into a situation 
which was normal and expected given the bug that resulted in the end of the 
function being reached without returning.

- Jonathan M Davis


More information about the Digitalmars-d mailing list