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

--- Comment #11 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:4ba94abf147fe7778a7541849ce27cafee74df9b

commit r13-4525-g4ba94abf147fe7778a7541849ce27cafee74df9b
Author: Jonathan Wakely <jwak...@redhat.com>
Date:   Mon Dec 5 12:53:42 2022 +0000

    libstdc++: Add hint to compiler about vector invariants [PR106434]

    The PR shows a bogus warning where jump threading generates code for the
    undefined case that the insertion point is a value-initialized iterator
    but _M_finish and _M_end_of_storage are unequal (so at least one must be
    non-null). Using __builtin_unreachable() removes the bogus warning. Also
    add an assertion to diagnose undefined misuses of a null iterator here,
    so we don't just silently optimize that undefined code to something
    unsafe.

    libstdc++-v3/ChangeLog:

            PR c++/106434
            * include/bits/vector.tcc (insert(const_iterator, const T&)):
            Add assertion and optimization hint that the iterator for the
            insertion point must be non-null.

Reply via email to