diff --git a/compiler-rt/lib/tsan/go/test.c b/compiler-rt/lib/tsan/go/test.c index d328ab1b331d7..fcd396227a4ab 100644 --- a/compiler-rt/lib/tsan/go/test.c +++ b/compiler-rt/lib/tsan/go/test.c @@ -91,6 +91,10 @@ int main(void) { __tsan_go_start(thr0, &thr1, (char*)&barfoo + 1); void *thr2 = 0; __tsan_go_start(thr0, &thr2, (char*)&barfoo + 1); + // Goroutine that exits without a single event. + void *thr3 = 0; + __tsan_go_start(thr0, &thr3, (char*)&barfoo + 1); + __tsan_go_end(thr3); __tsan_func_exit(thr0); __tsan_func_enter(thr1, (char*)&foobar + 1); __tsan_func_enter(thr1, (char*)&foobar + 1); diff --git a/compiler-rt/lib/tsan/rtl/tsan_trace.h b/compiler-rt/lib/tsan/rtl/tsan_trace.h index 01bb7b34f43a2..1e791ff765fec 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_trace.h +++ b/compiler-rt/lib/tsan/rtl/tsan_trace.h @@ -190,7 +190,7 @@ struct Trace { Mutex mtx; IList parts; // First node non-queued into ctx->trace_part_recycle. - TracePart* local_head; + TracePart* local_head = nullptr; // Final position in the last part for finished threads. Event* final_pos = nullptr; // Number of trace parts allocated on behalf of this trace specifically.