Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / tsan / sleep_sync2.cpp
bloba1a7a3accb48b295675c1c87cb33a3594288e3db
1 // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
2 #include "test.h"
4 int X = 0;
6 void *Thread(void *p) {
7 X = 42;
8 barrier_wait(&barrier);
9 return 0;
12 int main() {
13 barrier_init(&barrier, 2);
14 pthread_t t;
15 sleep(1); // must not appear in the report
16 pthread_create(&t, 0, Thread, 0);
17 barrier_wait(&barrier);
18 X = 43;
19 pthread_join(t, 0);
20 return 0;
23 // CHECK: WARNING: ThreadSanitizer: data race
24 // CHECK-NOT: As if synchronized via sleep