[Issue 7149] New: Segfault on Array Append from Multiple Threads in GDC and LDC: Race Condition?

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Dec 21 20:49:35 PST 2011


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

           Summary: Segfault on Array Append from Multiple Threads in GDC
                    and LDC:  Race Condition?
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: critical
          Priority: P2
         Component: druntime
        AssignedTo: nobody at puremagic.com
        ReportedBy: dsimcha at yahoo.com


--- Comment #0 from David Simcha <dsimcha at yahoo.com> 2011-12-21 20:49:31 PST ---
import core.thread;

void main() {
    auto t = new Thread(&doIt);
    t.start();
    doIt();
}

void doIt() {
    while(1) {
        int[] arr1, arr2;
        double[] arr3;

        foreach(i; 0..10_000) {
            arr1 ~= 1;
            arr2 ~= 2;
            arr3 ~= 3;
        }
    }
}

This code segfaults on both GDC
(https://bitbucket.org/goshawk/gdc/issue/295/null-pointer-deref-in-_d_arrayappendctp)
and LDC (https://github.com/ldc-developers/ldc/issues/56).  It works on DMD or
of doIt() is only called from one thread.  

Since this is broken on both GDC and LDC it's worth having a bug report in the
main druntime database.  My gut feeling is that there's a concurrency bug
that's triggered by some compiler optimization that GDC and LDC do but DMD
doesn't do.

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