September 08, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=929





------- Comment #9 from default_357-line@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


-- 

September 08, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=929





------- Comment #10 from default_357-line@yahoo.de  2007-09-08 11:44 -------
Update: The underlying issue seems to be that the wrong version of _d_arraysetlength gets called - for zero initializers it should be ...lengthT but ...lengthiT is what ends up being called in this case. Seems to be a compiler bug of sorts.


-- 

February 03, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=929


swadenator@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |swadenator@gmail.com




------- Comment #11 from swadenator@gmail.com  2008-02-02 19:27 -------
Is there any update to this problem?  I've been attempting to write some code like this and have been getting exactly this error with DMD 1.026 on a win32 box.

thanks,

wade


-- 

June 05, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=929


gide@nwawudu.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vsb@vsb.name




------- Comment #12 from gide@nwawudu.com  2008-06-05 16:18 -------
*** Bug 2135 has been marked as a duplicate of this bug. ***


-- 

July 29, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=929





------- Comment #13 from kamm-removethis@incasoftware.de  2008-07-29 01:56 -------
If I am not mistaken, Tomas fixed this in LLVMDC by providing an isZeroInit() overload in TypeAArray that returns TRUE.


-- 

October 03, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=929





------- Comment #14 from wbaxter@gmail.com  2008-10-02 22:56 -------
(In reply to comment #7)
> Ouch.  This one just bit me too.
> So throw in my "vote" or whatever.
> This needs a-fixin' pronto.
> 
> Thanks for the workaround suggestion, Nick.
> 

This just bit me again!

Also one new tidbit of info: in addition to using a class to work around this you can also wrap the AA in a struct.

struct CharToUint
{
    uint[char[]] map;
}

CharToUint[] x;  x.length = 20;  // no probs


-- 

October 21, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=929





------- Comment #15 from kamm-removethis@incasoftware.de  2008-10-21 12:40 -------
Just to make the patch more explicit: Adding

int TypeAArray::isZeroInit()
{
    return 1;
}

to mtype.c and the matching prototype to mtype.h fixes it. Tested in LDC.


-- 

November 15, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=929





------- Comment #16 from jarrett.billingsley@gmail.com  2008-11-14 21:55 -------
If Walter's looking for low-hanging fruit, it doesn't get much lower than this.
 A 5-line diff?  Why has this been open for almost 2 years, anyway?


-- 

November 20, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=929


smjg@iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |someanon@yahoo.com




------- Comment #17 from smjg@iname.com  2008-11-20 13:28 -------
*** Bug 1898 has been marked as a duplicate of this bug. ***


-- 

November 20, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=929


smjg@iname.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |smjg@iname.com




------- Comment #18 from smjg@iname.com  2008-11-20 13:31 -------
From issue 1898: allocating an array of AAs using new also hangs, as in

int[int][] maps;
maps = new int[int][3];

There's a workaround, calling .dup on a static array of AAs, but it requires that the length be known at compile time.


--