[Issue 929] Resizing array of associative arrays (uint[char[]][]) causes infinite loop / hang
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Sep 8 09:32:45 PDT 2007
http://d.puremagic.com/issues/show_bug.cgi?id=929
------- Comment #9 from default_357-line at yahoo.de 2007-09-08 11:32 -------
Here's a patch against GDC's phobos/internal/gc/gc.d that fixes the issue.
It was caused by incorrect/missing handling of the "init.length is 0" case in
array resize (the correct behavior is filling with zeroes).
diff ~/gcc/dgcc/d/phobos/internal/gc/gc.d
~/gcc/gcc-4.1.2/libphobos/internal/gc/gc.d
632c632
< assert(initsize);
---
> // assert(initsize); // size 0 means fill with zeroes
634c634
< assert((sizeelem / initsize) * initsize == sizeelem);
---
> assert(!initsize || ((sizeelem / initsize) * initsize == sizeelem));
714a715,719
> if (initsize == 0)
> {
> memset(newdata + size, 0, newsize - size);
> }
> else
--
More information about the Digitalmars-d-bugs
mailing list