Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / tsan / race_range_pc.cpp
blob30d89e549fd0aa55ae2df09db8cb831559d31e48
1 // RUN: %clangxx_tsan -O1 %s -o %t && %deflake %run %t | FileCheck %s
2 // This test fails on powerpc64 big endian.
3 // The Tsan report is returning wrong information about
4 // the location of the race.
5 // XFAIL: target=powerpc64-unknown-linux-gnu{{.*}}
7 #include "test.h"
9 typedef unsigned long uptr;
10 extern "C" void __tsan_read_range_pc(uptr addr, uptr size, uptr pc);
11 extern "C" void __tsan_write_range_pc(uptr addr, uptr size, uptr pc);
13 void foobar() {
16 void barbaz() {
19 void *Thread(void *p) {
20 barrier_wait(&barrier);
21 __tsan_read_range_pc((uptr)p, 32, (uptr)foobar + kPCInc);
22 return 0;
25 int main() {
26 barrier_init(&barrier, 2);
27 int a[128];
28 pthread_t th;
29 pthread_create(&th, 0, Thread, (void*)a);
30 __tsan_write_range_pc((uptr)(a+2), 32, (uptr)barbaz + kPCInc);
31 barrier_wait(&barrier);
32 pthread_join(th, 0);
33 fprintf(stderr, "DONE\n");
34 return 0;
37 // CHECK: WARNING: ThreadSanitizer: data race
38 // CHECK: #0 foobar
39 // CHECK: #0 barbaz
40 // CHECK: DONE