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

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


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Mike Lothian (FireBurn)

<details>
<summary>Changes</summary>

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

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


1 Files Affected:

- (modified) libc/test/UnitTest/HermeticTestUtils.cpp (+1-1) 


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

``````````

</details>


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


More information about the libc-commits mailing list