www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15943] New: wrong code for extern(C++) thread local variables

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 puremagic.com
          Reporter: r.sagitario 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].

--
Apr 21 2016