1// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
2#include "test.h"
3
4volatile int X;
5
6void *Thread1(void *x) {
7 barrier_wait(&barrier);
8 X = 42;
9 X = 66;
10 X = 78;
11 return 0;
12}
13
14void *Thread2(void *x) {
15 X = 11;
16 X = 99;
17 X = 73;
18 barrier_wait(&barrier);
19 return 0;
20}
21
22int main() {
23 barrier_init(&barrier, 2);
24 pthread_t t;
25 pthread_create(&t, 0, Thread1, 0);
26 Thread2(0);
27 pthread_join(t, 0);
28}
29
30// CHECK: ThreadSanitizer: reported 1 warnings
31