4 // RUN: %clangxx_tsan -O1 %s -o %t-dir/global_race.cpp.exe && %deflake %run %t-dir/global_race.cpp.exe 2>&1 \
7 // Also check that memory access instrumentation can be configured by either
8 // driver or legacy flags:
10 // RUN: %clangxx_tsan -O1 %s -o %t-dir/global_race.cpp.exe -fno-sanitize-thread-memory-access && not %deflake %run %t-dir/global_race.cpp.exe 2>&1 \
11 // RUN: | FileCheck --allow-empty --check-prefix=CHECK-MEMORY-ACCESS-OFF %s
12 // RUN: %clangxx_tsan -O1 %s -o %t-dir/global_race.cpp.exe -mllvm -tsan-instrument-memory-accesses=0 && not %deflake %run %t-dir/global_race.cpp.exe 2>&1 \
13 // RUN: | FileCheck --allow-empty --check-prefix=CHECK-MEMORY-ACCESS-OFF %s
19 void *Thread(void *a
) {
20 barrier_wait(&barrier
);
26 barrier_init(&barrier
, 2);
27 print_address("addr=", 1, GlobalData
);
29 pthread_create(&t
, 0, Thread
, 0);
31 barrier_wait(&barrier
);
35 // CHECK: addr=[[ADDR:0x[0-9,a-f]+]]
36 // CHECK: WARNING: ThreadSanitizer: data race
37 // CHECK: Location is global 'GlobalData' {{(of size 40 )?}}at [[ADDR]] (global_race.cpp.exe+0x{{[0-9,a-f]+}})
39 // CHECK-MEMORY-ACCESS-OFF-NOT: WARNING: ThreadSanitizer: data race