Compile this code for Win64 with "dmd -m32mscoff test.d": module test; private __gshared int transform; shared static this() { transform = 3; } and check the object file output with "dumpbin /disasm /all test.obj": _D4test18_sharedStaticCtor1FZv: 00000000: C7 05 00 00 00 00 mov dword ptr [__TMP0],3 03 00 00 00 0000000A: C3 ret i.e. there is a temporary symbol created for the variable access instead of the actual symbol itself, as the dump for the Win64 build shows: _D4test18_sharedStaticCtor1FZv: 0000000000000000: 55 push rbp 0000000000000001: 48 8B EC mov rbp,rsp 0000000000000004: C7 05 00 00 00 00 mov dword ptr [_D4test9transformi],3 03 00 00 00 000000000000000E: 5D pop rbp 000000000000000F: C3 ret This causes bad relocation entries to be built into the executable and causing failures for the phobos unit tests.
https://github.com/D-Programming-Language/dmd/pull/4504
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/6b426b369ec0a7e040412ecd75a381e87d051701 Merge pull request #4504 from rainers/issue_14311 fix Issue 14311 - Win32 COFF: don't loose symbol information for global data accesses
Commit pushed to stable at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/6b426b369ec0a7e040412ecd75a381e87d051701 Merge pull request #4504 from rainers/issue_14311