[PATCH] D118804: Revert "[Clang] Propagate guaranteed alignment for malloc and others"
Fangrui Song via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 2 10:52:37 PST 2022
MaskRay added a comment.
In D118804#3291060 <https://reviews.llvm.org/D118804#3291060>, @xbolva00 wrote:
> Or can we bailout just for gnu? and preserve this for darwin?
As is, the original patch applies the C++ getNewAlign to C calloc/malloc/strdup/etc. This is outright wrong.
For C++, I confess I have some problems interpreting this sentence:
(https://eel.is/c++draft/cpp.predefined)
> `__STDCPP_DEFAULT_NEW_ALIGNMENT__`: An integer literal of type std::size_t whose value is the alignment guaranteed by a call to operator new(std::size_t) or operator new[](std::size_t). [ Note: Larger alignments will be passed to operator new(std::size_t, std::align_val_t), etc. (8.3.4). — end note ]
It seems to suggest that a large alignment may be assumed, but practically, I know at least mimalloc uses 8-byte alignment for 64-bit Darwin, not 16-byte alignment.
> Or can we bailout just for gnu? and preserve this for darwin?
If deemed useful, someone may create a subsequent patch applying a fixed/restricted form.
This needs to be very careful since `__STDCPP_DEFAULT_NEW_ALIGNMENT__` doesn't seem to match the practice.
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