https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107801

--- Comment #13 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:75e562d2c4303d3918be9d1563284b0c580c5e45

commit r13-4371-g75e562d2c4303d3918be9d1563284b0c580c5e45
Author: Jonathan Wakely <jwak...@redhat.com>
Date:   Mon Nov 28 13:28:53 2022 +0000

    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.

Reply via email to