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

--- Comment #9 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-13 branch has been updated by Jonathan Wakely
<r...@gcc.gnu.org>:

https://gcc.gnu.org/g:8f633fe7c7d03ed6c0ce029a831037a6274a0882

commit r13-9486-g8f633fe7c7d03ed6c0ce029a831037a6274a0882
Author: Jonathan Wakely <jwak...@redhat.com>
Date:   Fri Mar 28 22:00:38 2025 +0000

    libstdc++: Fix bogus -Wstringop-overflow in std::vector::insert [PR117983]

    This was fixed on trunk by r15-4473-g3abe751ea86e34, but that isn't
    suitable for backporting. Instead, just add another unreachable
    condition in std::vector::_M_range_insert so the compiler knows this
    memcpy doesn't use a length originating from a negative ptrdiff_t
    converted to a very positive size_t.

    libstdc++-v3/ChangeLog:

            PR libstdc++/117983
            * include/bits/vector.tcc (vector::_M_range_insert): Add
            unreachable condition to tell the compiler begin() <= end().
            * testsuite/23_containers/vector/modifiers/insert/117983.cc: New
            test.

    Reviewed-by: Tomasz KamiÅski <tkami...@redhat.com>

    (cherry picked from commit 878812b6f6905774ab37cb78903e3e11bf1c508c)

Reply via email to