digitalmars.D.bugs - [Issue 4184] New: associative array with certain key types results in corrupt values during iteration
- d-bugmail puremagic.com (47/47) May 13 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4184
- d-bugmail puremagic.com (19/19) May 13 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4184
- d-bugmail puremagic.com (10/10) May 13 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4184
- d-bugmail puremagic.com (11/11) May 13 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4184
- d-bugmail puremagic.com (9/9) May 13 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4184
- d-bugmail puremagic.com (6/6) May 14 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4184
- d-bugmail puremagic.com (11/11) May 19 2010 http://d.puremagic.com/issues/show_bug.cgi?id=4184
http://d.puremagic.com/issues/show_bug.cgi?id=4184
Summary: associative array with certain key types results in
corrupt values during iteration
Product: D
Version: 2.041
Platform: Other
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: druntime
AssignedTo: sean invisibleduck.org
ReportedBy: schveiguy yahoo.com
10:38:05 PDT ---
The following code:
import std.stdio;
void main()
{
uint[ushort] aa;
aa[1] = 1;
aa[2] = 2;
aa[3] = 3;
aa[4] = 4;
aa[5] = 5;
writefln("%s", aa);
foreach(ushort k, uint v; aa)
{
writefln("%s => %s", k, v);
}
}
results in the following output:
[4:4,1:1,5:5,2:2,3:3]
4 => 262144
1 => 65536
5 => 327680
2 => 131072
3 => 196608
Clearly, the data is stored correctly, or else writefln would not be able to
get the correct values when displaying the AA directly. However, the iteration
code is getting corrupt values.
I suspect this is probably a druntime issue. It was introduced somewhere
between 2.033 (which works) and 2.036 (I haven't yet downloaded the
intermediate versions).
I will see if I can find the cause and commit a patch.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 13 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4184
Steven Schveighoffer <schveiguy yahoo.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Component|druntime |DMD
AssignedTo|sean invisibleduck.org |nobody puremagic.com
11:02:08 PDT ---
wow, nevermind, it is probably dmd.
Compiling this simple function results in pages and pages of AA functions in
disassembly, I'm not sure if druntime has anything to do with this bug.
void foo(uint[ushort] aa)
{
foreach(ushort k, uint v; aa)
{
}
}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 13 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4184
Walter Bright <bugzilla digitalmars.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bugzilla digitalmars.com
17:19:42 PDT ---
Printing things in hex yields 40000, 10000, 50000, 20000, 30000. Hmm.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 13 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4184
Walter Bright <bugzilla digitalmars.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
17:55:50 PDT ---
changeset 295
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 13 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4184 19:46:10 PDT --- Great, thanks! No wonder there was so much code generated, it's a template :) I didn't know the compiler associated AA's with a template. I'll test against dcollections tomorrow. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 13 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4184 04:31:27 PDT --- I confirm, it fixes the problems in dcollections, thanks. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 14 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4184
Steven Schveighoffer <schveiguy yahoo.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |Jesse.K.Phillips+D gmail.co
| |m
10:15:28 PDT ---
*** Issue 4209 has been marked as a duplicate of this issue. ***
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 19 2010









d-bugmail puremagic.com 