Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / tsan / stack_race2.cpp
blob00e31fb96b08e3d6343abd76c27432ea37559eb7
1 // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
2 #include "test.h"
4 void *Thread2(void *a) {
5 barrier_wait(&barrier);
6 *(int*)a = 43;
7 return 0;
10 void *Thread(void *a) {
11 int Var = 42;
12 pthread_t t;
13 pthread_create(&t, 0, Thread2, &Var);
14 Var = 42;
15 barrier_wait(&barrier);
16 pthread_join(t, 0);
17 return 0;
20 int main() {
21 barrier_init(&barrier, 2);
22 pthread_t t;
23 pthread_create(&t, 0, Thread, 0);
24 pthread_join(t, 0);
27 // CHECK: WARNING: ThreadSanitizer: data race
28 // CHECK: Location is stack of thread T1.