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

via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 7 13:42:46 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Fei Peng (airpfei)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/162369.diff


1 Files Affected:

- (modified) compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp (+2-1) 


``````````diff
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) {

``````````

</details>


https://github.com/llvm/llvm-project/pull/162369


More information about the llvm-commits mailing list