On Wed, Mar 04, 2026 at 11:54:09AM +0000, Jonathan Wakely wrote:
> 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.
> ---
>
> Tested x86_64-linux and bootstrapped pru-unknown-elf, confirming that it
> fixes the failed static_assert during bootstrap.
>
Jonathan, thank you for this fix. I can again run the testsuite for
full (hosted) libstdc++ on pru-unknown-elf. I do not see any
regressions for pru with this patch:
=== libstdc++ Summary ===
# of expected passes 2818
# of unexpected failures 95
# of expected failures 33
# of unresolved testcases 1
# of unsupported tests 7692
=== g++ Summary ===
# of expected passes 218059
# of unexpected failures 206
# of unexpected successes 3
# of expected failures 1469
# of unresolved testcases 12
# of unsupported tests 2778
Regards,
Dimitar