www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - assert codegen bug

reply "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
I don't know if I can reproduce this in a small amount of code.  This just 
came up in MiniD, and I have _no_ idea if I can get it to happen by 
whittling down the code, considering that it happens with a 5500-line file 
in an even bigger project.

Basically what's happening is that all the asserts in one of my modules 
(minid.types) are giving bogus pointers to the filename to the _d_assert_msg 
function.  The line number and custom message are being passed correctly, 
but the filename parameter is completely messed up, i.e. it's passing the 
value 0x30 as the pointer and some ridiculous value that points to nothing 
as the length.  This means that any time an assert trips in this module I 
get an incredibly hard-to-track-down MAV, which happens in the vsnprintf 
call in std.asserterror.

I've tried versions of DMD back to 1.006 and they all have the same problem, 
so it's not (that) new.

I have no idea what I did to make the asserts mess up like this, since they 
used to work.  I might be able to get to the bottom of this by compiling 
older revisions of MiniD, but.. 
Apr 09 2007
parent "Jarrett Billingsley" <kb3ctd2 yahoo.com> writes:
"Jarrett Billingsley" <kb3ctd2 yahoo.com> wrote in message 
news:evf2os$ppe$1 digitalmars.com...

Found it!  It seems to be a _very_ arcane bug involving templated functions 
that have asserts with messages in them which are declared in the same 
module as a class which also has an assert with a message in it.  No idea 
how else to describe it.  I'll put it in bugzilla, hopefully Walter will fix 
this one faster than he fixes most of the bugs I report.. 
Apr 10 2007