Bug 9353 – Memory corruption with mixin-generated code and -cov switch

Status
RESOLVED
Resolution
WORKSFORME
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2013-01-18T15:56:00Z
Last change time
2013-10-01T23:27:42Z
Keywords
ice
Assigned to
nobody
Creator
briancschott

Attachments

IDFilenameSummaryContent-TypeSize
1180tokenizer.dUgly Dustmite-reduced test casetext/x-dsrc1401

Comments

Comment #0 by briancschott — 2013-01-18T15:56:57Z
Created attachment 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.
Comment #1 by briancschott — 2013-05-21T14:52:07Z
Still present in dmd-2.063-beta5
Comment #2 by bugzilla — 2013-10-01T23:27:42Z
Works fine for dmd 2.064 head.