This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix incorrect assertion when deallocating big block
- From: Christophe Lyon <christophe dot lyon at linaro dot org>
- To: Jonathan Wakely <jwakely at redhat dot com>
- Cc: libstdc++ at gcc dot gnu dot org, gcc Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 14 Nov 2018 10:31:25 +0100
- Subject: Re: [PATCH] Fix incorrect assertion when deallocating big block
- References: <20181113225837.GA23685@redhat.com>
On Tue, 13 Nov 2018 at 23:58, Jonathan Wakely <jwakely@redhat.com> wrote:
>
> Since a big_block rounds up the size to a multiple of big_block::min it
> is wrong to assert that the supplied number of bytes equals the
> big_block's size(). Add big_block::alloc_size(size_t) to calculate the
> allocated size consistently, and add comments to the code.
>
> * src/c++17/memory_resource.cc (big_block): Improve comments.
> (big_block::all_ones): Remove.
> (big_block::big_block(size_t, size_t)): Use alloc_size.
> (big_block::size()): Add comment, replace all_ones with equivalent
> expression.
> (big_block::align()): Shift value of correct type.
> (big_block::alloc_size(size_t)): New function to round up size.
> (__pool_resource::allocate(size_t, size_t)): Add comment.
> (__pool_resource::deallocate(void*, size_t, size_t)): Likewise. Fix
> incorrect assertion by using big_block::alloc_size(size_t).
> * testsuite/20_util/unsynchronized_pool_resource/allocate.cc: Add
> more tests for unpooled allocations.
>
Hi Jonathan,
I've noticed that the updated test fails on arm*:
FAIL: 20_util/unsynchronized_pool_resource/allocate.cc execution test
the log says:
/libstdc++-v3/testsuite/20_util/unsynchronized_pool_resource/allocate.cc:232:
void test06(): Assertion 'false' failed.
The same happens on aarch64-elf with -mabi=ilp32
Christophe
> Tested x86_64-linux, committed to trunk.
>