https://issues.dlang.org/show_bug.cgi?id=18063
Issue ID: 18063
Summary: thread_attachThis returns dangling pointer
Product: D
Version: D2
Hardware: x86_64
OS: All
Status: NEW
Severity: major
Priority: P1
Component: druntime
Assignee: [email protected]
Reporter: [email protected]
thread_detachThis fails to reset the thread-local sm_this pointer; so,
thread_attachThis hands out a stale one.
The following call sequence from a non-D thread is sufficient to reproduce the
issue:
thread_attachThis();
thread_detachThis();
thread_attachThis();
Although, the effects of the undefined behavior shows up after exercising the
GC.
Pull request including a test program is coming shortly...
--