www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21910] New: Thread local variables hang the program in -betterC

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

          Issue ID: 21910
           Summary: Thread local variables hang the program in -betterC
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: critical
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: blatblatnik gmail.com

In 64bit windows builds, reading/writing thread local variables hangs the
program.

Forum post about this:
https://forum.dlang.org/post/prnlbekbxhmwggdjyhii forum.dlang.org

Steps to reproduce:
- Compiler: dmd 2.096.1
- Platform: Windows 10 64-bit

```
// test.d
int a; // thread local
extern(C) void main() {
  printf("before... ");
  a = 42; // The program hangs here.
  printf("after");
}
```

```
$ dmd -betterC test.d; ./test.exe
before... after

$ dmd -betterC -m64 test.d; ./test.exe
before... [program hangs for 3 seconds and exits without printing anything
else]
```

--
May 09