1 // RUN: %clangxx_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
7 void *Thread(void *p
) {
8 barrier_wait(&barrier
);
14 barrier_init(&barrier
, 2);
15 int const kHeapSize
= 1024 * 1024;
16 jptr jheap
= (jptr
)malloc(kHeapSize
+ 8) + 8;
17 __tsan_java_init(jheap
, kHeapSize
);
18 const int kBlockSize
= 64;
19 int const kMove
= 1024;
20 __tsan_java_alloc(jheap
, kBlockSize
);
22 varaddr2
= varaddr
+ kMove
;
24 pthread_create(&th
, 0, Thread
, 0);
26 __tsan_java_move(varaddr
, varaddr2
, kBlockSize
);
27 barrier_wait(&barrier
);
29 __tsan_java_free(varaddr2
, kBlockSize
);
30 fprintf(stderr
, "DONE\n");
31 return __tsan_java_fini();
34 // Note: there is a race on the moved object (which we used to detect),
35 // but now __tsan_java_move resets the object shadow, so we don't detect it anymore.
36 // CHECK-NOT: WARNING: ThreadSanitizer: data race