[Bug libstdc++/122255] Pointer tagging in filesystem::path::_List::_Impl assumes at least 4-byte alignment
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Oct 10 23:45:56 GMT 2025
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122255
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Actually increasing the alignment of _Impl won't help, because the operator new
call doesn't know we're allocating for _Impl.
We could pass std::align_val{4} to operator new, to ensure we get
sufficiently-aligned memory. If malloc already guarantees memory is at least
4-byte aligned, then in practice the code will always work anyway.
More information about the Gcc-bugs
mailing list