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

via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 26 15:34:06 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Alexander Richardson (arichardson)

<details>
<summary>Changes</summary>

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'`


---
Full diff: https://github.com/llvm/llvm-project/pull/106151.diff


1 Files Affected:

- (modified) compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h (+1-1) 


``````````diff
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

``````````

</details>


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


More information about the llvm-commits mailing list