Skip to content

Conversation

ndrewh
Copy link
Contributor

@ndrewh ndrewh commented Sep 29, 2025

Add some missing void* casts where we were passing an int for %p on some platforms.

rdar://161174839

@llvmbot
Copy link
Member

llvmbot commented Sep 29, 2025

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

Author: Andrew Haberlandt (ndrewh)

Changes

Add some missing void* casts where we were passing an int for %p on some platforms.

rdar://161174839


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

2 Files Affected:

  • (modified) compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp (+5-5)
  • (modified) compiler-rt/lib/tsan/rtl/tsan_platform_mac.cpp (+1-1)
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp
index 18ec1195e8eb0..c621bed2ba13b 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_mac.cpp
@@ -1147,8 +1147,8 @@ static void PrintVmmap() {
         lastsz += vmsize;
       } else {
         if (lastsz)
-          Printf("|| `[%p, %p]` || size=0x%016" PRIx64 " ||\n", last,
-                 last + lastsz, lastsz);
+          Printf("|| `[%p, %p]` || size=0x%016" PRIx64 " ||\n", (void*)last,
+                 (void*)(last + lastsz), (void*)lastsz);
 
         last = address;
         lastsz = vmsize;
@@ -1158,8 +1158,8 @@ static void PrintVmmap() {
       // We've reached the end of the memory map. Print the last remaining
       // region, if there is one.
       if (lastsz)
-        Printf("|| `[%p, %p]` || size=0x%016" PRIx64 " ||\n", last,
-               last + lastsz, lastsz);
+        Printf("|| `[%p, %p]` || size=0x%016" PRIx64 " ||\n", (void*)last,
+               (void*)(last + lastsz), lastsz);
 
       break;
     }
@@ -1170,7 +1170,7 @@ static void ReportShadowAllocFail(uptr shadow_size_bytes, uptr alignment) {
   Report(
       "FATAL: Failed to allocate shadow memory. Tried to allocate %p bytes "
       "(alignment=%p).\n",
-      shadow_size_bytes, alignment);
+      (void*)shadow_size_bytes, (void*)alignment);
   PrintVmmap();
 }
 
diff --git a/compiler-rt/lib/tsan/rtl/tsan_platform_mac.cpp b/compiler-rt/lib/tsan/rtl/tsan_platform_mac.cpp
index 5e1ea06b6236e..62ab0554df08e 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_platform_mac.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_platform_mac.cpp
@@ -239,7 +239,7 @@ void InitializePlatformEarly() {
     Report(
         "ThreadSanitizer: Unsupported virtual memory layout: Address %p is "
         "already mapped.\n",
-        HiAppMemEnd() - 1);
+        (void*)(HiAppMemEnd() - 1));
     Die();
   }
 #endif

Copy link
Contributor

@DanBlackwell DanBlackwell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, please check the comment as two similar looking calls have differing casts.

@ndrewh ndrewh requested a review from DanBlackwell September 30, 2025 17:23
@thetruestblue thetruestblue self-requested a review October 7, 2025 15:14
@DanBlackwell DanBlackwell merged commit 5960f5c into llvm:main Oct 7, 2025
9 checks passed
ndrewh added a commit to swiftlang/llvm-project that referenced this pull request Oct 11, 2025
…lvm#161282)

Add some missing void* casts where we were passing an int for %p on some
platforms.

rdar://161174839
(cherry picked from commit 5960f5c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants