[PATCH] D118804: Revert "[Clang] Propagate guaranteed alignment for malloc and others"

James Y Knight via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 2 09:49:56 PST 2022


jyknight added a comment.

In D118804#3290874 <https://reviews.llvm.org/D118804#3290874>, @collares wrote:

> It is worth noting that GCC started assuming 16-byte alignment for small objects in 2016, before N2293 was written and accepted into C2x; see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90569#c8 and https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90569#c9 for more recent (informal) statements from GCC developers.

Note that linked bug is about assumed alignment (to decide which allocator to call for C++ "new X", which uses max_align_t as part of its decision (quite reasonably). For malloc assumed-alignment, GCC uses the value MALLOC_ABI_ALIGNMENT (e.g. https://github.com/gcc-mirror/gcc/blob/c123096cf14ac87875bba51279e46cceeb18faa1/gcc/tree-ssa-ccp.cc#L2336), which is set to BITS_PER_WORD by default, unless overridden by a target config. On x86, it's not overridden, and thus is BITS_PER_WORD (so 32 or 64)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118804



More information about the cfe-commits mailing list