[compiler-rt] [sanitizer-common] Ensure at least sizeof(void*) alignment in sanitizer allocator (PR #84440)

Alexander Richardson via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 22 10:44:02 PDT 2024


================
@@ -59,7 +59,7 @@ static void *RawInternalAlloc(uptr size, InternalAllocatorCache *cache,
 
 static void *RawInternalRealloc(void *ptr, uptr size,
                                 InternalAllocatorCache *cache) {
-  uptr alignment = 8;
+  constexpr usize alignment = Max<usize>(8, sizeof(void *));
----------------
arichardson wrote:

It is the correct type, it's a size not a pointer/integer union (uinptr_t).

 This helps silence pedantic warnings for CHERI compilers since the value is a size_t (64-bit value) and not a uintptr_t (128 bit). No functional change for other architectures.

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


More information about the llvm-commits mailing list