[compiler-rt] 2c6448c - [sanitizer] Define 32bit uptr as uint
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 16 14:23:54 PDT 2021
Author: Vitaly Buka
Date: 2021-08-16T14:23:45-07:00
New Revision: 2c6448cdc2f68f8c28fd0bd9404182b81306e6e6
URL: https://github.com/llvm/llvm-project/commit/2c6448cdc2f68f8c28fd0bd9404182b81306e6e6
DIFF: https://github.com/llvm/llvm-project/commit/2c6448cdc2f68f8c28fd0bd9404182b81306e6e6.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..db26d9e213f22 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)
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
@@ -182,15 +187,17 @@ typedef uptr OFF_T;
#endif
typedef u64 OFF64_T;
-#if (SANITIZER_WORDSIZE == 64) || SANITIZER_MAC
+#if (SANITIZER_WORDSIZE == 64)
typedef uptr operator_new_size_type;
#else
-# if defined(__s390__) && !defined(__s390x__)
+# if defined(__s390__) && !defined(__s390x__)
// Special case: 31-bit s390 has unsigned long as size_t.
typedef unsigned long operator_new_size_type;
-# else
+# elif SANITIZER_MAC
+typedef unsigned long operator_new_size_type;
+# else
typedef u32 operator_new_size_type;
-# endif
+# endif
#endif
typedef u64 tid_t;
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