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

           Summary: segfault while returning an atomicLoad value
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: [email protected]
        ReportedBy: [email protected]


--- Comment #0 from Puneet Goel <[email protected]> 2012-11-30 01:44:50 PST 
---
Works with dmd-2.059. Does not work with the current github snapshot and with
dmd-2.060.

Strangely, if the "this" function is not defined for the Foo struct. The code
works fine -- no segfault. Alternatively if I store the value returned by
alomicLoad in a local variable before returning it from the function foo, the
code still runs fine.



// minimal code that gives segfault

import core.atomic;

struct Foo {
  private ulong _s = 0;
  public this (ulong s) { // no segfault if this function is commented out
    this._s = s;
  }
}

auto foo () {
  shared static Foo bar;
  // shared frop = atomicLoad(bar);
  // return frop;  // no segfault
  return atomicLoad(bar);   // segfaults here
}

void main() {
  foo();
}

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

Reply via email to