[compiler-rt] [compiler-rt] Fix definition of `uptr` (and `usize`) on 32-bit Windows (PR #106151)

Alexander Richardson via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 26 15:33:37 PDT 2024


https://github.com/arichardson created https://github.com/llvm/llvm-project/pull/106151

32-bit Windows uses `unsigned int` for uintptr_t and size_t.
Commit 18e06e3e2f3d47433e1ed323b8725c76035fc1ac claims that size_t is
unsigned long, but MSVC complains if we define usize as unsigned long
since that results in:
`error C2821: first formal parameter to 'operator new' must be 'size_t'`


>From 6e565d96c4234c98ce6c008873e36cc5168db575 Mon Sep 17 00:00:00 2001
From: Alex Richardson <alexrichardson at google.com>
Date: Mon, 26 Aug 2024 15:33:18 -0700
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
 =?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.6-beta.1
---
 compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h | 2 +-
 1 file changed, 1 insertion(+), 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 3af47c2e2ff7a7..fefe28e811767d 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
@@ -143,7 +143,7 @@ namespace __sanitizer {
 typedef unsigned long long uptr;
 typedef signed long long sptr;
 #else
-#  if (SANITIZER_WORDSIZE == 64) || SANITIZER_APPLE || SANITIZER_WINDOWS
+#  if (SANITIZER_WORDSIZE == 64) || SANITIZER_APPLE
 typedef unsigned long uptr;
 typedef signed long sptr;
 #  else



More information about the llvm-commits mailing list