[compiler-rt] 45138f7 - [sanitizer] Define 32bit uptr as uint
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 14 16:54:00 PDT 2021
Author: Vitaly Buka
Date: 2021-08-14T16:53:46-07:00
New Revision: 45138f788c9b3c4ac5d9ae4479841c411c15190e
URL: https://github.com/llvm/llvm-project/commit/45138f788c9b3c4ac5d9ae4479841c411c15190e
DIFF: https://github.com/llvm/llvm-project/commit/45138f788c9b3c4ac5d9ae4479841c411c15190e.diff
LOG: [sanitizer] Define 32bit uptr as uint
This makes it consistent with uintptr_t.
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 f7fdc160eeb1c..07b303e06a098 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
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