www.digitalmars.com         C & C++   DMDScript  

D.gnu - [Bug 188] New: invalid free during AssertError destructor

http://d.puremagic.com/bugzilla/show_bug.cgi?id=188

           Summary: invalid free during AssertError destructor
           Product: GDC
           Version: 0.18
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: braddr puremagic.com
        ReportedBy: braddr puremagic.com


69     try
     70     {
     71         assert(false, "test 6 " ~ test5func());
     72         writefln("test 6 failed -- it didn't throw when it should
have");
     73     }
     74     catch (AssertError e)
     75     {
     76         if (e.msg == "test 6 message")
     77             writefln("test 6 passed ");
     78         else
     79             writefln("test 6 failed -- threw the wrong message");
     80     }

$ gdc -g -funittest -fdebug -o assert-test assert-test.d 
$ ./assert-test 
test 6 passed 
*** glibc detected *** free(): invalid pointer: 0x401d1fe0 ***
Aborted (core dumped)

Breakpoint 1, std.asserterror.AssertError._dtor() (this= 0x401d4fc0) at
../../../gcc-4.0.2/libphobos/std/asserterror.d:56
56              {   std.c.stdlib.free(msg.ptr);
(gdb) print this.msg
$1 = {length = 14, ptr = 0x401d1fe0 "test 6 message"}
(gdb) next
*** glibc detected *** free(): invalid pointer: 0x401d1fe0 ***

I can't reproduce this with dmd 0.160 so I'm assigning this to gdc for now.  It
could well be something in the front end or phobos since I haven't dug into it
much.


-- 
Jun 09 2006