Thread overview | |||||
---|---|---|---|---|---|
|
December 05, 2006 [Issue 653] New: AAs are slightly broken | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=653 Summary: AAs are slightly broken Product: D Version: 0.176 Platform: PC OS/Version: Windows Status: NEW Severity: major Priority: P1 Component: DMD AssignedTo: bugzilla@digitalmars.com ReportedBy: mslenc@gmail.com import std.stdio; void main() { int[uint] aa; aa[1236448822] = 0; aa[2716102924] = 1; aa[ 315901071] = 2; aa.remove(1236448822); writefln(aa[2716102924]); } ======================== The reason it happens is in aaA.d: int c = key_hash - e.hash; //... if (c < 0) { e = e.left; } else { e = e.right; } If key_hash is bigger than e.hash + int.max, this will incorrectly determine that it is in fact smaller. The loop should be changed to something like while (e) { if (key_hash == e.hash) { int c = keyti.compare(pkey, e + 1); if (c) { e = c < 0 ? e.left : e.right; } else { return cast(void *)(e + 1) + keysize; } } else { e = key_hash < e.hash ? e.left : e.right; } } -- |
December 06, 2006 Re: [Issue 653] New: AAs are slightly broken | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail Attachments: | d-bugmail@puremagic.com schrieb am 2006-12-05: > http://d.puremagic.com/issues/show_bug.cgi?id=653 > import std.stdio; > > void main() > { > int[uint] aa; > > aa[1236448822] = 0; > aa[2716102924] = 1; > aa[ 315901071] = 2; > > aa.remove(1236448822); > writefln(aa[2716102924]); > } > >======================== > > The reason it happens is in aaA.d: <snip> Added to DStress as http://dstress.kuehne.cn/run/a/associative_array_20_A.d Thomas |
December 12, 2006 [Issue 653] AAs are slightly broken | ||||
---|---|---|---|---|
| ||||
Posted in reply to d-bugmail | http://d.puremagic.com/issues/show_bug.cgi?id=653 bugzilla@digitalmars.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED ------- Comment #2 from bugzilla@digitalmars.com 2006-12-12 04:16 ------- Fixed DMD 0.176 -- |
Copyright © 1999-2021 by the D Language Foundation