[compiler-rt] 5f7dc8a - [compiler-rt][TSan] Fix TSan compile error on Android (#162369)

via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 7 13:59:48 PDT 2025


Author: Fei Peng
Date: 2025-10-07T13:59:44-07:00
New Revision: 5f7dc8ad11c096a556d49ee676bb627eb8b5cd11

URL: https://github.com/llvm/llvm-project/commit/5f7dc8ad11c096a556d49ee676bb627eb8b5cd11
DIFF: https://github.com/llvm/llvm-project/commit/5f7dc8ad11c096a556d49ee676bb627eb8b5cd11.diff

LOG: [compiler-rt][TSan] Fix TSan compile error on Android (#162369)

Added: 
    

Modified: 
    compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp b/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp
index 6b6538735beb0..61c9bbb03f7f2 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp
@@ -680,7 +680,8 @@ ThreadState *cur_thread() {
   // significant bit of TLS_SLOT_SANITIZER to 1. Scudo allocator uses this bit
   // as a flag to disable memory initialization. This is a workaround to get the
   // correct ThreadState pointer.
-  reinterpret_cast<ThreadState*>(addr & ~1ULL);
+  uptr addr = reinterpret_cast<uptr>(thr);
+  return reinterpret_cast<ThreadState*>(addr & ~1ULL);
 }
 
 void set_cur_thread(ThreadState *thr) {


        


More information about the llvm-commits mailing list