Bug 5579 – Segfault on first call to GC after starting new thread

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2011-02-14T17:46:00Z
Last change time
2011-02-14T22:24:29Z
Assigned to
nobody
Creator
dsimcha

Comments

Comment #0 by dsimcha — 2011-02-14T17:46:30Z
The following code segfaults on about 50% of runs. This happens in both 32-bit and 64-bit Linux and on Windows, regardless of how the -O, -inline, and -release flags are set. import core.memory, core.thread; void doNothing() {} void main() { auto t = new Thread(&doNothing); t.start; GC.collect(); }
Comment #1 by bugzilla — 2011-02-14T21:31:23Z
It faults on this code in druntime/src/rt/lifetime.d: ================================== // we expect this to be called with the lock in place extern(C) void rt_processGCMarks(void[] tls) { // called after the mark routine to eliminate block cache data when it // might be ready to sweep debug(PRINTF) printf("processing GC Marks, %x\n", tls.ptr); auto cache = *cast(BlkInfo **)(tls.ptr + __blkcache_offset); ^^^^^^^^^^^^^^^^^^^^^^^^^^^ ================================= Both tls.ptr and __blkcache_offset are NULL.
Comment #2 by bugzilla — 2011-02-14T22:24:29Z