www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2690] New: DMD aborts with MALLOC_CHECK_ set

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2690

           Summary: DMD aborts with MALLOC_CHECK_ set
           Product: D
           Version: 1.040
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Keywords: ice-on-invalid-code
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: larsivar igesund.net


I don't know how common it is, but at least Ubuntu has a standard environment
variable called MALLOC_CHECK_ which typically is set to 2. When it is set,
memory allocations are checked (it can also be set to 3). However, with DMD
1.040 this causes an "Aborted" message. Setting MALLOC_CHECK_ to 0 makes it
work again.

I have tried to narrow down where it happens, but I seem to fail to get it much
shorter than the following (and it seems that Exception itself from object.di
may be involved):

class PlatformException : Exception
{
    this(char[] msg)
{
super(msg);
}
}
class AssertException : Exception
{
    this(char[] file, size_t line)
{
super("Assertion failure",file,line);
}
    this(char[] msg, char[] file, size_t line)
{
super(msg,file,line);
}
}
void setAssertHandler(int){
}

This is a regression in DMD 1.040


-- 
Feb 25 2009
next sibling parent reply Lutger <lutger.blijdestijn gmail.com> writes:
Also happens in dmd 2.025

When MALLOC_CHECK_ set to 1, I get the following message:

*** glibc detected *** dmd: realloc(): invalid pointer: 0x08d2c6a8 ***
Segmentation fault
Feb 25 2009
parent reply "Denis Koroskin" <2korden gmail.com> writes:
On Thu, 26 Feb 2009 02:27:43 +0300, Lutger <lutger.blijdestijn gmail.com> wrote:

 Also happens in dmd 2.025

 When MALLOC_CHECK_ set to 1, I get the following message:

 *** glibc detected *** dmd: realloc(): invalid pointer: 0x08d2c6a8 ***
 Segmentation fault
Perhaps, you may want to post it to bugzilla, instead?
Feb 25 2009
next sibling parent reply Jarrett Billingsley <jarrett.billingsley gmail.com> writes:
On Wed, Feb 25, 2009 at 7:05 PM, Denis Koroskin <2korden gmail.com> wrote:
 On Thu, 26 Feb 2009 02:27:43 +0300, Lutger <lutger.blijdestijn gmail.com>
 wrote:

 Also happens in dmd 2.025

 When MALLOC_CHECK_ set to 1, I get the following message:

 *** glibc detected *** dmd: realloc(): invalid pointer: 0x08d2c6a8 ***
 Segmentation fault
Perhaps, you may want to post it to bugzilla, instead?
It's supposed to work, i.e. responding to the NG thread is supposed to post to the Bugzilla as well. It just stopped working a couple months ago..
Feb 25 2009
parent "Denis Koroskin" <2korden gmail.com> writes:
On Thu, 26 Feb 2009 03:24:06 +0300, Jarrett Billingsley
<jarrett.billingsley gmail.com> wrote:

 On Wed, Feb 25, 2009 at 7:05 PM, Denis Koroskin <2korden gmail.com>  
 wrote:
 On Thu, 26 Feb 2009 02:27:43 +0300, Lutger  
 <lutger.blijdestijn gmail.com>
 wrote:

 Also happens in dmd 2.025

 When MALLOC_CHECK_ set to 1, I get the following message:

 *** glibc detected *** dmd: realloc(): invalid pointer: 0x08d2c6a8 ***
 Segmentation fault
Perhaps, you may want to post it to bugzilla, instead?
It's supposed to work, i.e. responding to the NG thread is supposed to post to the Bugzilla as well. It just stopped working a couple months ago..
Yeah, I know. That's why I suggested to re-submit the post to bugzilla. I actually like the way it is, it allows commenting the reports while sidestepping the bugzilla. This is useful if your comment is worthless anyway. Just like this one :)
Feb 25 2009
prev sibling parent Lutger <lutger.blijdestijn gmail.com> writes:
Denis Koroskin wrote:

 On Thu, 26 Feb 2009 02:27:43 +0300, Lutger <lutger.blijdestijn gmail.com> 
wrote:
 
 Also happens in dmd 2.025

 When MALLOC_CHECK_ set to 1, I get the following message:

 *** glibc detected *** dmd: realloc(): invalid pointer: 0x08d2c6a8 ***
 Segmentation fault
Perhaps, you may want to post it to bugzilla, instead?
I see that's not working now anymore, good to know. Anyway it seems Walter already solved it.
Feb 27 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2690






I didn't know about MALLOC_CHECK_. It's a great feature, and I found the (off
by one) problem.


-- 
Feb 26 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2690


bugzilla digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED





Fixed dmd 1.041 and 2.026


-- 
Mar 11 2009