[compiler-rt] 7256c05 - [sanitizer] Define 32bit uptr as uint

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 16 15:46:56 PDT 2021


Author: Vitaly Buka
Date: 2021-08-16T15:46:37-07:00
New Revision: 7256c05ecb76137f1e4ac255e128fb9c73d6b4a5

URL: https://github.com/llvm/llvm-project/commit/7256c05ecb76137f1e4ac255e128fb9c73d6b4a5
DIFF: https://github.com/llvm/llvm-project/commit/7256c05ecb76137f1e4ac255e128fb9c73d6b4a5.diff

LOG: [sanitizer] Define 32bit uptr as uint

This makes it consistent with uintptr_t.

It's 45138f788c9b3c4ac5d9ae4479841c411c15190e with Darwin fix.

Reviewed By: kstoimenov

Differential Revision: https://reviews.llvm.org/D108163

Added: 
    

Modified: 
    compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
    compiler-rt/lib/sanitizer_common/tests/sanitizer_bitvector_test.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h b/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
index 056b00a10e2be..45165f6269513 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
@@ -139,8 +139,13 @@ namespace __sanitizer {
 typedef unsigned long long uptr;
 typedef signed long long sptr;
 #else
+#  if (SANITIZER_WORDSIZE == 64) || SANITIZER_MAC
 typedef unsigned long uptr;
 typedef signed long sptr;
+#  else
+typedef unsigned int uptr;
+typedef signed int sptr;
+#  endif
 #endif  // defined(_WIN64)
 #if defined(__x86_64__)
 // Since x32 uses ILP32 data model in 64-bit hardware mode, we must use

diff  --git a/compiler-rt/lib/sanitizer_common/tests/sanitizer_bitvector_test.cpp b/compiler-rt/lib/sanitizer_common/tests/sanitizer_bitvector_test.cpp
index 670e96552c68f..385b6158300ca 100644
--- a/compiler-rt/lib/sanitizer_common/tests/sanitizer_bitvector_test.cpp
+++ b/compiler-rt/lib/sanitizer_common/tests/sanitizer_bitvector_test.cpp
@@ -71,7 +71,7 @@ void Print(const set<uptr> &s) {
 #if defined(_WIN64)
     fprintf(stderr, "%llu ", *it);
 #else
-    fprintf(stderr, "%lu ", *it);
+    fprintf(stderr, "%zu ", *it);
 #endif
   }
   fprintf(stderr, "\n");


        


More information about the llvm-commits mailing list