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

via libc-commits libc-commits at lists.llvm.org
Thu Jun 27 13:50:16 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));
----------------
PiJoules wrote:

>From the allocator perspective, I think it shouldn't matter where the actual block is located. We could configure an allocator object such that this is guaranteed for the very first block, but I think that might be trying to test the underlying machinery rather than the allocator API which doesn't really guarantee it.

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


More information about the libc-commits mailing list