[PATCH] PR libstdc++/70940 make pmr::resource_adaptor return aligned memory
Jonathan Wakely
jwakely@redhat.com
Thu Jun 21 15:22:00 GMT 2018
On 21/06/18 15:00 +0100, Jonathan Wakely wrote:
> virtual void
>- do_deallocate(void* __p, size_t __bytes, size_t __alignment)
>+ do_deallocate(void* __p, size_t __bytes, size_t __alignment) noexcept
>+ override
> {
>- using _Aligned_alloc = std::__alloc_rebind<_Alloc, char>;
>- size_t __new_size = _S_aligned_size(__bytes,
>- _S_supported(__alignment) ?
>- __alignment : _S_max_align);
>- using _Ptr = typename allocator_traits<_Aligned_alloc>::pointer;
>- _Aligned_alloc(_M_alloc).deallocate(static_cast<_Ptr>(__p),
>- __new_size);
>+ auto __ptr = static_cast<char*>(__p);
>+ if (__alignment == 1)
>+ _M_alloc.deallocate(__ptr, __bytes);
Oops, this is missing a return!
Patch incoming ...
More information about the Libstdc++
mailing list