This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] PR libstdc++/70940 make pmr::resource_adaptor return aligned memory


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 ...


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]