digitalmars.D.bugs - [Issue 929] New: Resizing array of associative arrays (uint[char[]][]) causes infinite loop / hang
- d-bugmail puremagic.com (25/25) Feb 03 2007 http://d.puremagic.com/issues/show_bug.cgi?id=929
- d-bugmail puremagic.com (11/11) Feb 04 2007 http://d.puremagic.com/issues/show_bug.cgi?id=929
- d-bugmail puremagic.com (11/17) Feb 04 2007 http://d.puremagic.com/issues/show_bug.cgi?id=929
- d-bugmail puremagic.com (5/8) Feb 04 2007 http://d.puremagic.com/issues/show_bug.cgi?id=929
- d-bugmail puremagic.com (6/6) Feb 04 2007 http://d.puremagic.com/issues/show_bug.cgi?id=929
- d-bugmail puremagic.com (10/10) Apr 05 2007 http://d.puremagic.com/issues/show_bug.cgi?id=929
- d-bugmail puremagic.com (16/16) May 24 2007 http://d.puremagic.com/issues/show_bug.cgi?id=929
- d-bugmail puremagic.com (7/7) May 28 2007 http://d.puremagic.com/issues/show_bug.cgi?id=929
- d-bugmail puremagic.com (6/6) Jul 07 2007 http://d.puremagic.com/issues/show_bug.cgi?id=929
- d-bugmail puremagic.com (8/8) Jul 07 2007 http://d.puremagic.com/issues/show_bug.cgi?id=929
- d-bugmail puremagic.com (15/22) Sep 08 2007 http://d.puremagic.com/issues/show_bug.cgi?id=929
- d-bugmail puremagic.com (7/7) Sep 08 2007 http://d.puremagic.com/issues/show_bug.cgi?id=929
- d-bugmail puremagic.com (12/12) Feb 02 2008 http://d.puremagic.com/issues/show_bug.cgi?id=929
- d-bugmail puremagic.com (8/8) Jun 05 2008 http://d.puremagic.com/issues/show_bug.cgi?id=929
- d-bugmail puremagic.com (5/5) Jul 28 2008 http://d.puremagic.com/issues/show_bug.cgi?id=929
- d-bugmail puremagic.com (12/18) Oct 02 2008 http://d.puremagic.com/issues/show_bug.cgi?id=929
- d-bugmail puremagic.com (9/9) Oct 21 2008 http://d.puremagic.com/issues/show_bug.cgi?id=929
- d-bugmail puremagic.com (5/5) Nov 14 2008 http://d.puremagic.com/issues/show_bug.cgi?id=929
- d-bugmail puremagic.com (8/8) Nov 20 2008 http://d.puremagic.com/issues/show_bug.cgi?id=929
- d-bugmail puremagic.com (12/12) Nov 20 2008 http://d.puremagic.com/issues/show_bug.cgi?id=929
- d-bugmail puremagic.com (9/9) Dec 02 2008 http://d.puremagic.com/issues/show_bug.cgi?id=929
- d-bugmail puremagic.com (8/8) Dec 13 2008 http://d.puremagic.com/issues/show_bug.cgi?id=929
http://d.puremagic.com/issues/show_bug.cgi?id=929 Summary: Resizing array of associative arrays (uint[char[]][]) causes infinite loop / hang Product: D Version: 1.004 Platform: PC OS/Version: Windows Status: NEW Severity: major Priority: P2 Component: DMD AssignedTo: bugzilla digitalmars.com ReportedBy: nick.atamas gmail.com The following code produces an infinite loop. When executed "before" is printed but "after" is never reached. import std.stdio; int main() { uint[char[]][] fractal; writefln("before"); fractal.length = 10; writefln("after"); return 0; } --
Feb 03 2007
http://d.puremagic.com/issues/show_bug.cgi?id=929 fvbommel wxs.nl changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |accepts-invalid ------- Comment #1 from fvbommel wxs.nl 2007-02-04 04:41 ------- http://www.digitalmars.com/d/arrays.html#associative (under "Properties"): .length Returns number of values in the associative array. Unlike for dynamic arrays, it is read-only. So this shouldn't even compile... --
Feb 04 2007
http://d.puremagic.com/issues/show_bug.cgi?id=929 torhu yahoo.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |torhu yahoo.com Keywords|accepts-invalid | ------- Comment #2 from torhu yahoo.com 2007-02-04 08:11 ------- (In reply to comment #1)http://www.digitalmars.com/d/arrays.html#associative (under "Properties"): .length Returns number of values in the associative array. Unlike for dynamic arrays, it is read-only. So this shouldn't even compile...uint[char[]][] fractal; fractal is a dynamic array, so length is not read-only. --
Feb 04 2007
http://d.puremagic.com/issues/show_bug.cgi?id=929 ------- Comment #3 from fvbommel wxs.nl 2007-02-04 08:20 ------- (In reply to comment #2)uint[char[]][] fractal; fractal is a dynamic array, so length is not read-only.Ah, I missed the last brackets. Sorry about that. --
Feb 04 2007
http://d.puremagic.com/issues/show_bug.cgi?id=929 ------- Comment #4 from nick.atamas gmail.com 2007-02-04 11:35 ------- This worked just fine in DMD1.0. It was broken recently. I am currently using a workaround - encapsulating uint[char[]] into a class and making an array of those. --
Feb 04 2007
http://d.puremagic.com/issues/show_bug.cgi?id=929 thomas-dloop kuehne.cn changed: What |Removed |Added ---------------------------------------------------------------------------- OS/Version|Windows |All ------- Comment #5 from thomas-dloop kuehne.cn 2007-04-05 11:33 ------- Added to DStress as http://dstress.kuehne.cn/run/l/length_11_A.d http://dstress.kuehne.cn/run/l/length_11_B.d --
Apr 05 2007
http://d.puremagic.com/issues/show_bug.cgi?id=929 svv1999 hotmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|major |critical Priority|P2 |P1 Version|1.004 |1.001 ------- Comment #6 from svv1999 hotmail.com 2007-05-24 13:23 ------- Just stumbled on this when recompiling an older project. To me dynamic and associative arrays are key features of D. The bug was introduced with version 1.001. Therefore increased priority as well as severity and set Version to 1.001. The bug shows up on upsizing only. Downsizing by assigning to length is possible. The type `int[int][]' is sufficient to show the bug. --
May 24 2007
http://d.puremagic.com/issues/show_bug.cgi?id=929 ------- Comment #7 from wbaxter gmail.com 2007-05-28 02:28 ------- 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. --
May 28 2007
http://d.puremagic.com/issues/show_bug.cgi?id=929 deewiant gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|critical |regression --
Jul 07 2007
http://d.puremagic.com/issues/show_bug.cgi?id=929 deewiant gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |d0ccrazy web.de ------- Comment #8 from deewiant gmail.com 2007-07-07 09:43 ------- *** Bug 1321 has been marked as a duplicate of this bug. *** --
Jul 07 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 zeroes634c634 < assert((sizeelem / initsize) * initsize == sizeelem); ---assert(!initsize || ((sizeelem / initsize) * initsize == sizeelem));714a715,719if (initsize == 0) { memset(newdata + size, 0, newsize - size); } else--
Sep 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. --
Sep 08 2007
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 --
Feb 02 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. *** --
Jun 05 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. --
Jul 28 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 --
Oct 02 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. --
Oct 21 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? --
Nov 14 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. *** --
Nov 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. --
Nov 20 2008
http://d.puremagic.com/issues/show_bug.cgi?id=929 kamm-removethis incasoftware.de changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED ------- Comment #19 from kamm-removethis incasoftware.de 2008-12-02 12:36 ------- has been fixed in DMD 1.037 and 2.021 --
Dec 02 2008
http://d.puremagic.com/issues/show_bug.cgi?id=929 arthur.loiret gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |arthur.loiret gmail.com ------- Comment #20 from arthur.loiret gmail.com 2008-12-13 04:41 ------- Fixed in gdc SVN revision 244 as well, thanks! --
Dec 13 2008