www.digitalmars.com         C & C++   DMDScript  

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

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: dsimcha yahoo.com



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: -------
Dec 21 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7149


safety0ff.bugz <safety0ff.bugz gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |safety0ff.bugz gmail.com



02:23:21 PDT ---
The LDC & GDC issues have been closed in their trackers, can this be closed?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 28 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7149


Iain Buclaw <ibuclaw ubuntu.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |ibuclaw ubuntu.com
         Resolution|                            |FIXED



Yes, see this pull into druntime:

https://github.com/D-Programming-Language/druntime/commit/01212a6b3f7d369347f485b64336b6cd2c55d46e

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