[Issue 4184] New: associative array with certain key types results in corrupt values during iteration

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu May 13 10:38:09 PDT 2010


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 at invisibleduck.org
        ReportedBy: schveiguy at yahoo.com


--- Comment #0 from Steven Schveighoffer <schveiguy at yahoo.com> 2010-05-13 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: -------


More information about the Digitalmars-d-bugs mailing list