[libc-commits] [libc] [libc] Add aligned_alloc (PR #96586)

Paul Kirth via libc-commits libc-commits at lists.llvm.org
Wed Jun 26 09:15:48 PDT 2024


================
@@ -47,10 +48,16 @@ TEST_FOR_EACH_ALLOCATOR(CanAllocate, 2048) {
   void *ptr = allocator.allocate(ALLOC_SIZE);
 
   ASSERT_NE(ptr, static_cast<void *>(nullptr));
-  // In this case, the allocator should be returning us the start of the chunk.
-  EXPECT_EQ(ptr, static_cast<void *>(
-                     reinterpret_cast<cpp::byte *>(allocator.region_start()) +
-                     FreeListHeap<>::BlockType::BLOCK_OVERHEAD));
----------------
ilovepi wrote:

can't this test control the allocator config, such that you can guarantee that invariant? If you think the test isn't useful, that's a different problem, but the rationale you've described sounds like it should be controllable in the test setup.

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


More information about the libc-commits mailing list