[Issue 15943] New: wrong code for extern(C++) thread local variables

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Apr 21 00:03:24 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=15943

          Issue ID: 15943
           Summary: wrong code for extern(C++) thread local variables
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Keywords: wrong-code
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: r.sagitario at gmx.de

Enhancing compilable/test15578 from the dmd testsuite:

private:
    int j;
    extern(C++, ns) int k;

void f()
{
    j = 1;
    k = 7;
}

void main()
{
    f();
    assert(j == 1);
    assert(k == 7); // fails
}

produces the assert. Inspecting the disassembly shows that the write operation
to k is silently omitted, while the read opertion reads garbage [ebp].

--


More information about the Digitalmars-d-bugs mailing list