[Issue 4681] New: Strange access violation Mandelbug with AAs + Appender

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Aug 19 10:15:49 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4681

           Summary: Strange access violation Mandelbug with AAs + Appender
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: critical
          Priority: P2
         Component: Phobos
        AssignedTo: nobody at puremagic.com
        ReportedBy: dsimcha at yahoo.com


--- Comment #0 from David Simcha <dsimcha at yahoo.com> 2010-08-19 10:15:45 PDT ---
The following code produces an access violation approximately 1 in 10 times
when run.  From observations that I haven't been able to reduce to a small test
case, it appears that memory corruption is also involved.  This bug is so
non-deterministic that I haven't the slightest clue how to debug it further. 
It appears related to the order in which the arrays are appended.  I tried
changing this to some simple deterministic things and can't reproduce this bug
w/o the random index selection.

import std.stdio, std.random, std.array;

void main() {
    Appender!(float[], float)[string] aa;

    string[] indices = ["aa", "bb", "cc", "dd", "ee", "ff", "gg", "hh", "ii"];
    foreach(i; 0..10_000) {
        float f = i;
        auto index = indices[uniform(0, indices.length)];

        if(index !in aa) {
            aa[index] = typeof(aa[index]).init;
        }
        aa[index].put(f);
    }
}

-- 
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