[libc-commits] [PATCH] D149863: [libc] Maintain proper alignment for the hermetic tests malloc

Joseph Huber via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu May 4 09:56:36 PDT 2023


jhuber6 added inline comments.


================
Comment at: libc/test/UnitTest/HermeticTestUtils.cpp:66
+  // Keep the bump pointer aligned on an eight byte boundary.
+  s = ((s + 8 - 1) / 8) * 8;
   void *mem = ptr;
----------------
sivachandra wrote:
> Is it 8 that we want or is it `alignof(uintptr_t)`?
Eight is just a good number. I think to be consistent with most implementations of malloc it's `alignof(long double)` or something. But I could change it to use that number since it's clearer to say "We want alignment for at least a 64-bit type"


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149863/new/

https://reviews.llvm.org/D149863



More information about the libc-commits mailing list