1 // RUN: %clang_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
4 void *thread(void *x
) {
5 barrier_wait(&barrier
);
6 *static_cast<int *>(x
) = 2;
13 pthread_create(&t
, nullptr, thread
, &data
);
15 barrier_wait(&barrier
);
16 pthread_join(t
, nullptr);
20 __attribute__((noinline
))
25 barrier_init(&barrier
, 2);
26 fprintf(stderr
, "DONE\n");
30 // CHECK: WARNING: ThreadSanitizer: data race
31 // CHECK: Write of size 4
33 // CHECK: Previous write of size 4
35 // CHECK: #1 at_exit_callback_installed_at