Win64, merge-2.067, LLVM master, VS 2015 - current status

kinke via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Sat May 16 15:51:52 PDT 2015


After intensive debugging, the strange issue responsible for most 
failures seems to be reducible to some unit tests allocating GC 
memory, this in turn leading to a GC collection pass which then 
destroys the `__gshared core.thread.Thread 
core.thread.Thread.sm_tbeg` object representing the main thread 
(it's actually the start of a linked list of threads). The object 
should actually be kept alive by the sm_tbeg reference (and the 
main Thread additionally by sm_main). After initializing the 
reference with the main Thread at program startup, it isn't 
touched (i.e., not reset to null - verified via data breakpoint), 
but the object is finalized anyway.

So it looks as if the GC doesn't know about these __gshared 
references. When accessing the linked list later, when 
terminating all threads right before exiting the program, funny 
things happen due to garbage in the .next and .prev references.

I've just tried storing another reference to the main Thread as 
`static Thread core.thread.Thread.sm_mainDummy`, and the object 
isn't destroyed anymore. So `gshared` seems to be the problem. 
And most likely all other targets are affected too by this bug.


More information about the digitalmars-d-ldc mailing list