From 45138f788c9b3c4ac5d9ae4479841c411c15190e Mon Sep 17 00:00:00 2001 From: Vitaly Buka Date: Sat, 14 Aug 2021 16:51:10 -0700 Subject: [PATCH] [sanitizer] Define 32bit uptr as uint This makes it consistent with uintptr_t. --- compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h | 5 +++++ .../lib/sanitizer_common/tests/sanitizer_bitvector_test.cpp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h b/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h index f7fdc160eeb1..07b303e06a09 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 670e96552c68..385b6158300c 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 &s) { #if defined(_WIN64) fprintf(stderr, "%llu ", *it); #else - fprintf(stderr, "%lu ", *it); + fprintf(stderr, "%zu ", *it); #endif } fprintf(stderr, "\n");