https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122300
--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jonathan Wakely <[email protected]>: https://gcc.gnu.org/g:e159c788516df36bb265163e7abcbd10014cf920 commit r16-7925-ge159c788516df36bb265163e7abcbd10014cf920 Author: Jonathan Wakely <[email protected]> Date: Wed Mar 4 10:54:16 2026 +0000 libstdc++: Use aligned new for filesystem::path internals [PR122300] As Bug 122300 shows, we have at least one target where the static_assert added by r16-4422-g1b18a9e53960f3 fails. This patch resurrects the original proposal for using aligned new that I posted in https://gcc.gnu.org/pipermail/libstdc++/2025-October/063904.html Instead of just asserting that the memory from operator new will be sufficiently aligned, check whether it will be and use aligned new if needed. We don't just use aligned new unconditionally, because that can add overhead on targets where malloc already meets the requirements. libstdc++-v3/ChangeLog: PR libstdc++/122300 * src/c++17/fs_path.cc (path::_List::_Impl): Remove static_asserts. (path::_List::_Impl::required_alignment) (path::_List::_Impl::use_aligned_new): New static data members. (path::_List::_Impl::create_unchecked): Check use_aligned_new and use aligned new if needed. (path::_List::_Impl::alloc_size): New static member function. (path::_List::_Impl_deleter::operator): Check use_aligned_new and use aligned delete if needed. Reviewed-by: Tomasz KamiÅski <[email protected]>
