Corruption of shared data with multiple threads

Johan Engelen via digitalmars-d-ldc digitalmars-d-ldc at
Sun Mar 29 09:46:22 PDT 2015

Hi all,
   I am working on adding coverage analysis (like DMD's) to LDC.
It is a work in progress, but you can test the current status 
It already works nicely, but the line count is not increased for 
all types of statements yet. I've been breaking my head on a 
problem with multithreaded programs.

This test program works fine (ldc2 -cov test.d)
void main() {
void fun(...) {
and outputs the same line count as dmd does.
Making the program multithreaded, like this:
import std.concurrency;
void main() {
void fun(...) {
no longer works. (it actually used to work for me, but for some 
reason with a completely rebuilt druntime, it crashes). I've 
traced the problem back to the Cover[] gdata data structure in 
druntime/cover.d becoming corrupted somewhere during program 
execution. More specifically, in struct Cover, filename.length 
becomes corrupted somehow.

Is it a known issue, that we have some bugs with shared data + 
multiple threads?


(LLVM 3.6, MSVC, x64)

More information about the digitalmars-d-ldc mailing list