1 // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
2 #include "test.h"
3 
4 namespace XXX {
5 struct YYY {
6   static int ZZZ[10];
7 };
8 int YYY::ZZZ[10];
9 }
10 
Thread(void * a)11 void *Thread(void *a) {
12   barrier_wait(&barrier);
13   XXX::YYY::ZZZ[0] = 1;
14   return 0;
15 }
16 
main()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);
25 }
26 
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]+}})
30