[PATCH] D104402: [scudo] Ensure proper allocator alignment in TSD test

Vitaly Buka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 16 11:47:19 PDT 2021


vitalybuka added inline comments.


================
Comment at: compiler-rt/lib/scudo/standalone/tsd_shared.h:157
     const u32 Index = atomic_fetch_add(&CurrentIndex, 1U, memory_order_relaxed);
+    DCHECK(isAligned(reinterpret_cast<uptr>(&TSDs[Index % NumberOfTSDs]),
+                     SCUDO_CACHE_LINE_SIZE));
----------------
vitalybuka wrote:
> Should we just check isAligned(this, alignof(*this)) ?
> 
I guess alignas in allocator promises alignment which is not delivered buy "new"
So maybe more consistent solution is just to put DCHECK(isAligned) into every class with alignas statement.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104402



More information about the llvm-commits mailing list