[Issue 20497] New: thread with limited stackspace crashes depending on size of TLS
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Jan 10 17:49:31 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=20497
Issue ID: 20497
Summary: thread with limited stackspace crashes depending on
size of TLS
Product: D
Version: D2
Hardware: All
OS: Linux
Status: NEW
Severity: critical
Priority: P1
Component: druntime
Assignee: nobody at puremagic.com
Reporter: r.sagitario at gmx.de
import core.thread;
import core.stdc.stdio;
ubyte[9000] data;
void task()
{
ubyte[1024] useStack;
printf("%p\n", useStack.ptr);
}
void main()
{
auto th = new Thread(&task, 16384);
th.start();
th.join();
}
Running this code on Ubuntu 19 crashes with a segmentation fault. If the size
of data[] is reduced to 8000, the program runs as expected. With size of data[]
of 16kB, you get the error
core.thread.osthread.ThreadError at src/core/thread/osthread.d(3184): Error
creating thread
--
More information about the Digitalmars-d-bugs
mailing list