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)11void *Thread(void *a) { 12 barrier_wait(&barrier); 13 XXX::YYY::ZZZ[0] = 1; 14 return 0; 15 } 16 main()17int main() { 18 barrier_init(&barrier, 2); 19 fprintf(stderr, "addr3="); 20 print_address(XXX::YYY::ZZZ); 21 fprintf(stderr, "\n"); 22 pthread_t t; 23 pthread_create(&t, 0, Thread, 0); 24 XXX::YYY::ZZZ[0] = 0; 25 barrier_wait(&barrier); 26 pthread_join(t, 0); 27 } 28 29 // CHECK: addr3=[[ADDR3:0x[0-9,a-f]+]] 30 // CHECK: WARNING: ThreadSanitizer: data race 31 // CHECK: Location is global 'XXX::YYY::ZZZ' of size 40 at [[ADDR3]] ({{.*}}+0x{{[0-9,a-f]+}}) 32