diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2022-11-28 13:28:53 +0000 |
---|---|---|
committer | Jonathan Wakely <jwakely@redhat.com> | 2022-11-28 16:57:36 +0000 |
commit | 75e562d2c4303d3918be9d1563284b0c580c5e45 (patch) | |
tree | 24dff8d635cd42d1448fa1d825d631ab8b39fde9 /gcc | |
parent | a7b97a1f6b9d4993545525fd5cb334ae640ddf45 (diff) | |
download | gcc-75e562d2c4303d3918be9d1563284b0c580c5e45.zip gcc-75e562d2c4303d3918be9d1563284b0c580c5e45.tar.gz gcc-75e562d2c4303d3918be9d1563284b0c580c5e45.tar.bz2 |
libstdc++: Fix src/c++17/memory_resource for H8 targets [PR107801]
This fixes compilation failures for H8 multilibs. For the normal
multilib (ILP16L32?), the chunk struct does not have the expected size,
because uint32_t is type long and has alignment 4 (by default). This
forces sizeof(chunk) to be 12 instead of the expected 10. We can fix
that by using bitset::size_type instead of uint32_t, so that we only use
a 16-bit size when size_t and pointers are 16-bit types.
For the I32LP16 multilibs that use -mint32 int is wider than size_t
and so arithmetic expressions involving size_t promote to int. This
means we need some explicit casts back to size_t.
libstdc++-v3/ChangeLog:
PR libstdc++/107801
* src/c++17/memory_resource.cc (chunk::_M_bytes): Change type
from uint32_t to bitset::size_type. Adjust static assertion.
(__pool_resource::_Pool::replenish): Cast to size_t after
multiplication instead of before.
(__pool_resource::_M_alloc_pools): Ensure both arguments to
std::max have type size_t.
Diffstat (limited to 'gcc')
0 files changed, 0 insertions, 0 deletions