https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118681
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2025-01-28
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
// Override for memory_resource::do_allocate
void*
unsynchronized_pool_resource::do_allocate(size_t bytes, size_t alignment)
{
const auto block_size = std::max(bytes, alignment);
if (block_size <= _M_impl._M_opts.largest_required_pool_block)
{
// Recreate pools if release() has been called:
if (__builtin_expect(_M_pools == nullptr, false))
_M_pools = _M_impl._M_alloc_pools();
if (auto pool = _M_find_pool(block_size))
return pool->allocate(upstream_resource(), _M_impl._M_opts);
}
return _M_impl.allocate(bytes, alignment);
}
Yes that code looks wrong for the pool case. It does not take into account the
alignment.