diff --git a/compiler-rt/lib/tsan/rtl/tsan_interface_inl.h b/compiler-rt/lib/tsan/rtl/tsan_interface_inl.h --- a/compiler-rt/lib/tsan/rtl/tsan_interface_inl.h +++ b/compiler-rt/lib/tsan/rtl/tsan_interface_inl.h @@ -83,21 +83,15 @@ } void __tsan_vptr_update(void **vptr_p, void *new_val) { - CHECK_EQ(sizeof(vptr_p), 8); - if (*vptr_p != new_val) { - ThreadState *thr = cur_thread(); - thr->is_vptr_access = true; - MemoryAccess(thr, CALLERPC, (uptr)vptr_p, 8, AccessWrite); - thr->is_vptr_access = false; - } + if (*vptr_p == new_val) + return; + MemoryAccess(cur_thread(), CALLERPC, (uptr)vptr_p, sizeof(*vptr_p), + AccessWrite | AccessVptr); } void __tsan_vptr_read(void **vptr_p) { - CHECK_EQ(sizeof(vptr_p), 8); - ThreadState *thr = cur_thread(); - thr->is_vptr_access = true; - MemoryAccess(thr, CALLERPC, (uptr)vptr_p, 8, AccessRead); - thr->is_vptr_access = false; + MemoryAccess(cur_thread(), CALLERPC, (uptr)vptr_p, sizeof(*vptr_p), + AccessRead | AccessVptr); } void __tsan_func_entry(void *pc) { diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl.h b/compiler-rt/lib/tsan/rtl/tsan_rtl.h --- a/compiler-rt/lib/tsan/rtl/tsan_rtl.h +++ b/compiler-rt/lib/tsan/rtl/tsan_rtl.h @@ -698,6 +698,7 @@ AccessWrite = 0, AccessRead = 1 << 0, AccessAtomic = 1 << 1, + AccessVptr = 1 << 2, }; void MemoryAccess(ThreadState *thr, uptr pc, uptr addr, @@ -738,7 +739,11 @@ } bool is_write = !(typ & AccessRead); bool is_atomic = typ & AccessAtomic; + if (typ & AccessVptr) + thr->is_vptr_access = true; MemoryAccess(thr, pc, addr, size_log, is_write, is_atomic); + if (typ & AccessVptr) + thr->is_vptr_access = false; } void MemoryResetRange(ThreadState *thr, uptr pc, uptr addr, uptr size);