Thread overview
[Issue 9353] New: Memory corruption with mixin-generated code and -cov switch
Oct 02, 2013
Walter Bright
January 18, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9353

           Summary: Memory corruption with mixin-generated code and -cov
                    switch
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: brian-schott@cox.net


--- Comment #0 from brian-schott@cox.net 2013-01-18 15:56:57 PST ---
Created an attachment (id=1180)
Ugly Dustmite-reduced test case

I'm getting the following error from dmd 2.061 (and the latest in git master):

*** glibc detected *** dmd.backup: free(): invalid next size (fast):
0x0000000007b98560 ***

The call to free() in question is here: https://github.com/D-Programming-Language/dmd/blob/master/src/glue.c#L378

Moving the line "covb = (unsigned *)calloc((numlines + 32) / 32,
sizeof(*covb));" from 355 down to line 375 (just before the call to dtnbytes)
seems to work around this issue, but it really shouldn't if I'm reading the
code correctly.

I've attached a test case reduced by Dustmite. It's fairly ugly, and has the strange property that changing almost anything about the strings being mixed in causes the bug to not be triggered.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 21, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9353



--- Comment #1 from brian-schott@cox.net 2013-05-21 14:52:07 PDT ---
Still present in dmd-2.063-beta5

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 02, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9353


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |WORKSFORME


--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> 2013-10-01 23:27:42 PDT ---
Works fine for dmd 2.064 head.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------