Thread overview
[Issue 2690] New: DMD aborts with MALLOC_CHECK_ set
Feb 25, 2009
d-bugmail
Feb 25, 2009
Lutger
Feb 26, 2009
Denis Koroskin
Feb 26, 2009
Denis Koroskin
Feb 27, 2009
Lutger
Feb 26, 2009
d-bugmail
Mar 11, 2009
d-bugmail
February 25, 2009
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


-- 

February 25, 2009
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

February 26, 2009
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?

February 26, 2009
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..
February 26, 2009
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 :)

February 26, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2690





------- Comment #1 from bugzilla@digitalmars.com  2009-02-26 04:19 -------
I didn't know about MALLOC_CHECK_. It's a great feature, and I found the (off
by one) problem.


-- 

February 27, 2009
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.

March 11, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2690


bugzilla@digitalmars.com changed:

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




------- Comment #2 from bugzilla@digitalmars.com  2009-03-11 14:54 -------
Fixed dmd 1.041 and 2.026


--