Thread overview
[Issue 3337] New: weird behavior of associative arrays
Sep 22, 2009
ZHOU Zhenyu
Sep 22, 2009
David Simcha
Sep 22, 2009
David Simcha
Feb 03, 2011
ZY Zhou
September 22, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3337

           Summary: weird behavior of associative arrays
           Product: D
           Version: 2.032
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: rinick@gmail.com


--- Comment #0 from ZHOU Zhenyu <rinick@gmail.com> 2009-09-21 19:59:37 PDT ---
int[int[]] t;
t[[1]] = 1;
writeln(t);

output:
[[1245088]:1]

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 22, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3337


David Simcha <dsimcha@yahoo.com> changed:

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


--- Comment #1 from David Simcha <dsimcha@yahoo.com> 2009-09-21 21:37:01 PDT ---
Probably uninitialized memory or something.  I'm also using 2.032, and using the following code:

import std.stdio;

void main() {
    int[int[]] t;
    t[[1]] = 1;
    writeln(t);
}


I get:

[[14]:1]

The point isn't the specific number, but the fact that the number is non-deterministic.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 22, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=3337



--- Comment #2 from David Simcha <dsimcha@yahoo.com> 2009-09-21 21:38:26 PDT ---
Oh yeah, also notable is that this isn't just a bug in converting to string. The following code produces an access violation:

import std.stdio;

void main() {
    int[int[]] t;
    t[[1]] = 1;
    writeln(t[[1]]);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 03, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=3337


ZY Zhou <rinick@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME


--- Comment #3 from ZY Zhou <rinick@gmail.com> 2011-02-03 08:09:20 PST ---
Seems this bug has already been fixed

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------