[Issue 5517] SEGV: assert(false) in release mode

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Jun 28 01:15:32 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=5517

--- Comment #15 from Jonathan M Davis <issues.dlang at jmdavisProg.com> ---
(In reply to Shachar Shemesh from comment #14)
> (In reply to Jonathan M Davis from comment #13)
> > Either way, it's killing the program like it's supposed to.
> 
> But it is not printing the message.
> 
> And this is a bug in the compiler.

Walter has made it clear that this is _not_ a bug in the compiler. The compiler
is not required to print a message in release mode. Rather, it quite
specifically inserts an HLT instruction - which isn't going to print a message.
And I very much doubt that the spec says anywhere that assertions print out
anything in release mode, since all other assertions get compiled out in
release mode, and the spec clearly states that assert(0) gets turned into a HLT
instruction in release mode. So, while I can see why you might want a message
in release mode, I don't see how you can claim that it's a compiler bug that
assert(0, "message") doesn't print one. Where in the spec gives you the idea
that assert(0, "message") would print out anything in release mode? If it
didn't print something when you compiled _without_ -release, then that would be
a bug, but if you compile with -release, you get a HLT instruction and no
message.

And even if there is somewhere in the spec that implies that assert(0,
"message") is supposed to print a message even in release mode, Walter has made
it clear that the compiler is doing what it's supposed to be doing, so if the
spec isn't clear enough on the matter, then the spec needs to be updated. The
compiler's current behavior is not going to be changed.

--


More information about the Digitalmars-d-bugs mailing list