[Bug libstdc++/77691] [7/8/9 regression] experimental/memory_resource/resource_adaptor.cc FAILs
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Sep 3 15:35:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77691
--- Comment #24 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I think this would make the tests pass, so you could remove the xfail
directives:
--- a/libstdc++-v3/include/experimental/memory_resource
+++ b/libstdc++-v3/include/experimental/memory_resource
@@ -421,7 +421,11 @@ namespace pmr {
do_allocate(size_t __bytes, size_t __alignment) override
{
if (__alignment <= __guaranteed_alignment<_Alloc>::value)
- return _M_alloc.allocate(__bytes);
+ {
+ if (__bytes < __alignment)
+ __bytes = __alignment;
+ return _M_alloc.allocate(__bytes);
+ }
const _AlignMgr __mgr(__bytes, __alignment);
// Assume _M_alloc returns 1-byte aligned memory, so allocate enough
@@ -437,6 +441,8 @@ namespace pmr {
auto __ptr = static_cast<char*>(__p);
if (__alignment <= __guaranteed_alignment<_Alloc>::value)
{
+ if (__bytes < __alignment)
+ __bytes = __alignment;
_M_alloc.deallocate(__ptr, __bytes);
return;
}
More information about the Gcc-bugs
mailing list