[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
Mon Feb 7 16:22:12 PST 2022

jyknight added a comment.

In D118804#3302675 <https://reviews.llvm.org/D118804#3302675>, @rsmith wrote:

> I support this revert.

Having received enough support, I'll go ahead and commit, and then propose backport to llvm 14 branch.

But --

> - `malloc` always returns storage whose alignment is at least the largest fundamental alignment.

As has been discussed previously in this review thread, that's not true -- and the in-practice-falseness of this statement was the trigger for reverting the change.

Not only is it not true in practice, it was clarified for C2x such that it's definitely not true per standard, either (while, before, it was unclear and could've been read either way). The current wording in C2x is: "The pointer returned if the allocation succeeds is suitably aligned so that it may be assigned to a pointer to any type of object with a fundamental alignment requirement and size less than or equal to the size requested.", see http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2293.htm

  rG LLVM Github Monorepo



More information about the cfe-commits mailing list