https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94906
--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jonathan Wakely <r...@gcc.gnu.org>: https://gcc.gnu.org/g:bb27781b64162e1769df15e0c97e8d2145d2d10d commit r11-53-gbb27781b64162e1769df15e0c97e8d2145d2d10d Author: Jonathan Wakely <jwak...@redhat.com> Date: Mon May 4 21:13:28 2020 +0100 libstdc++: Fix incorrect size calculation in PMR resource (PR 94906) Calculating the size of a chunk being returned to the upstream allocator was done with a 32-bit type, so it wrapped if the chunk was 4GB or larger. I don't know how to test this without allocating 4GB, so there's no test in the testsuite. It has been tested manually with allocations sizes and alignments exceeding 4GB. PR libstdc++/94906 * src/c++17/memory_resource.cc (monotonic_buffer_resource::_Chunk::release): Use size_t for shift operands.