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

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

https://gcc.gnu.org/g:00ac6fa3f2a54fb9cc17b7b7f51eae3c6bf7a1bd

commit r12-9330-g00ac6fa3f2a54fb9cc17b7b7f51eae3c6bf7a1bd
Author: Jonathan Wakely <jwak...@redhat.com>
Date:   Tue Mar 28 10:50:40 2023 +0100

    libstdc++: Tell GCC what basic_string::_M_is_local() means [PR109299]

    This avoids a bogus warning about overflowing a buffer, because GCC
    can't tell that we don't copy into the buffer unless it fits. By adding
    a __builtin_unreachable() hint we inform the compiler about the
    invariant that the buffer is only used when it's big enough.

    This can also improve codegen, by eliminating dead code that GCC
    couldn't tell was unreachable.

    libstdc++-v3/ChangeLog:

            PR libstdc++/109299
            * include/bits/basic_string.h (basic_string::_M_is_local()): Add
            hint for compiler that local strings fit in the local buffer.

    (cherry picked from commit bf78b43873b0b7e8f9a430df38749b8b61f9c9b8)

Reply via email to