[libc-commits] [libc] [libc] Align hermetic test allocations to max_align_t (PR #239984)

Mike Lothian via libc-commits libc-commits at lists.llvm.org
Sat Nov 7 06:45:21 PST 2026


https://github.com/FireBurn created https://github.com/llvm/llvm-project/pull/239984

The hermetic allocator handed out blocks aligned to a pointer. The compiler
may assume operator new returns memory aligned for the largest scalar type,
so an object zeroed with aligned vector stores faulted: dir_scan_impl_test
crashed in ReadFailsAtStart.

Assisted-by: Claude

>From 6fed5bae5559efbacf83ac42dfb2a6fc249ac991 Mon Sep 17 00:00:00 2001
From: Mike Lothian <mike at fireburn.co.uk>
Date: Sun, 11 Oct 2026 11:22:27 +0100
Subject: [PATCH] [libc] Align hermetic test allocations to max_align_t

The hermetic allocator handed out blocks aligned to a pointer. The compiler
may assume operator new returns memory aligned for the largest scalar type,
so an object zeroed with aligned vector stores faulted: dir_scan_impl_test
crashed in ReadFailsAtStart.

Assisted-by: Claude
---
 libc/test/UnitTest/HermeticTestUtils.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libc/test/UnitTest/HermeticTestUtils.cpp b/libc/test/UnitTest/HermeticTestUtils.cpp
index 3d9cb6d2cbf1e0..eb447fad13938b 100644
--- a/libc/test/UnitTest/HermeticTestUtils.cpp
+++ b/libc/test/UnitTest/HermeticTestUtils.cpp
@@ -30,7 +30,7 @@ int atexit(void (*func)(void));
 
 } // namespace LIBC_NAMESPACE_DECL
 
-constexpr uint64_t ALIGNMENT = alignof(uintptr_t);
+constexpr uint64_t ALIGNMENT = alignof(max_align_t);
 
 namespace {
 



More information about the libc-commits mailing list