From 4452d26a6dd9220e0041d9cdff37481d8735abee Mon Sep 17 00:00:00 2001 From: Fei Peng Date: Tue, 7 Oct 2025 13:35:57 -0700 Subject: [PATCH] [compiler-rt][TSan] Fix TSan compile error on Android --- compiler-rt/lib/tsan/rtl/tsan_platform_linux.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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(addr & ~1ULL); + uptr addr = reinterpret_cast(thr); + return reinterpret_cast(addr & ~1ULL); } void set_cur_thread(ThreadState *thr) {