diff options
Diffstat (limited to 'test/tsan/java_lock.cc')
-rw-r--r-- | test/tsan/java_lock.cc | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/test/tsan/java_lock.cc b/test/tsan/java_lock.cc index e5513cd2d..36a0f8b7b 100644 --- a/test/tsan/java_lock.cc +++ b/test/tsan/java_lock.cc @@ -15,21 +15,22 @@ void *Thread(void *p) { int main() { int const kHeapSize = 1024 * 1024; - void *jheap = malloc(kHeapSize); - __tsan_java_init((jptr)jheap, kHeapSize); + jptr jheap = (jptr)malloc(kHeapSize + 8) + 8; + __tsan_java_init(jheap, kHeapSize); const int kBlockSize = 16; - __tsan_java_alloc((jptr)jheap, kBlockSize); - varaddr = (jptr)jheap; - lockaddr = (jptr)jheap + 8; + __tsan_java_alloc(jheap, kBlockSize); + varaddr = jheap; + lockaddr = jheap + 8; pthread_t th; pthread_create(&th, 0, Thread, 0); __tsan_java_mutex_lock(lockaddr); *(int*)varaddr = 43; __tsan_java_mutex_unlock(lockaddr); pthread_join(th, 0); - __tsan_java_free((jptr)jheap, kBlockSize); - printf("OK\n"); + __tsan_java_free(jheap, kBlockSize); + fprintf(stderr, "DONE\n"); return __tsan_java_fini(); } // CHECK-NOT: WARNING: ThreadSanitizer: data race +// CHECK: DONE |