[Issue 1914] Array initialisation from const array yeilds memory trample

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Feb 13 14:09:34 PST 2010


http://d.puremagic.com/issues/show_bug.cgi?id=1914


Don <clugdbug at yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


--- Comment #8 from Don <clugdbug at yahoo.com.au> 2010-02-13 14:09:33 PST ---
ROOT CAUSE: The glue layer is misinterpreting it as an array block assignment,
so for a 5 element array, it duplicates the array five times. It recognizes
that strings are slice assignments rather than block assignments, but it needs
to do the same thing for array literals.


PATCH(against DMD2 svn 382): todt.c, line 1001 in TypeSArray::toDtElem.


    }
-    else if (e->op != TOKstring)
+    else if (e->op != TOKstring && e->op != TOKarrayliteral)
    {   // Array block assignment (rather than slice assignment)
        for (i = 1; i < len; i++)
        {
        if (tbn->ty == Tstruct)
        {   pdt = tnext->toDt(pdt);
            while (*pdt)
            pdt = &((*pdt)->DTnext);
        }
        else
            pdt = e->toDt(pdt);
        }
    }

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


More information about the Digitalmars-d-bugs mailing list