2015-01-07 19:55:37 +00:00
|
|
|
// RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
|
2015-02-10 07:45:43 +00:00
|
|
|
#include "test.h"
|
2015-01-07 19:55:37 +00:00
|
|
|
|
|
|
|
namespace XXX {
|
|
|
|
struct YYY {
|
|
|
|
static int ZZZ[10];
|
|
|
|
};
|
|
|
|
int YYY::ZZZ[10];
|
|
|
|
}
|
|
|
|
|
|
|
|
void *Thread(void *a) {
|
2015-02-10 07:45:43 +00:00
|
|
|
barrier_wait(&barrier);
|
2015-01-07 19:55:37 +00:00
|
|
|
XXX::YYY::ZZZ[0] = 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int main() {
|
2015-02-10 07:45:43 +00:00
|
|
|
barrier_init(&barrier, 2);
|
2015-12-30 11:52:19 +00:00
|
|
|
print_address("addr3=", 1, XXX::YYY::ZZZ);
|
2015-01-07 19:55:37 +00:00
|
|
|
pthread_t t;
|
|
|
|
pthread_create(&t, 0, Thread, 0);
|
|
|
|
XXX::YYY::ZZZ[0] = 0;
|
2015-02-10 07:45:43 +00:00
|
|
|
barrier_wait(&barrier);
|
2015-01-07 19:55:37 +00:00
|
|
|
pthread_join(t, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK: addr3=[[ADDR3:0x[0-9,a-f]+]]
|
|
|
|
// CHECK: WARNING: ThreadSanitizer: data race
|
2015-12-30 11:52:19 +00:00
|
|
|
// CHECK: Location is global 'XXX::YYY::ZZZ' {{(of size 40 )?}}at [[ADDR3]] ({{.*}}+0x{{[0-9,a-f]+}})
|