Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / tsan / global_race3.cpp
blob9d82daef51e5d6679ecee42b98eb290e876f3e2c
1 // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
2 #include "test.h"
4 namespace XXX {
5 struct YYY {
6 static int ZZZ[10];
7 };
8 int YYY::ZZZ[10];
11 void *Thread(void *a) {
12 barrier_wait(&barrier);
13 XXX::YYY::ZZZ[0] = 1;
14 return 0;
17 int main() {
18 barrier_init(&barrier, 2);
19 print_address("addr3=", 1, XXX::YYY::ZZZ);
20 pthread_t t;
21 pthread_create(&t, 0, Thread, 0);
22 XXX::YYY::ZZZ[0] = 0;
23 barrier_wait(&barrier);
24 pthread_join(t, 0);
27 // CHECK: addr3=[[ADDR3:0x[0-9,a-f]+]]
28 // CHECK: WARNING: ThreadSanitizer: data race
29 // CHECK: Location is global 'XXX::YYY::ZZZ' {{(of size 40 )?}}at [[ADDR3]] ({{.*}}+0x{{[0-9,a-f]+}})