Bug 15943 – wrong code for extern(C++) thread local variables
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2016-04-21T07:03:24Z
Last change time
2018-05-22T05:28:53Z
Keywords
C++, wrong-code
Assigned to
No Owner
Creator
Rainer Schuetze
Comments
Comment #0 by r.sagitario — 2016-04-21T07:03:24Z
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].
Comment #1 by turkeyman — 2018-05-22T05:28:53Z
Now emits the error:
error : variable `Source.ns.k` Internal Compiler Error: C++ static non-__gshared non-extern variables not supported
Seems reasonable?