https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114758
--- Comment #7 from GCC 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:1f6c19f307c8de9830130a0ba071c24e3835beb3 commit r15-9111-g1f6c19f307c8de9830130a0ba071c24e3835beb3 Author: Jonathan Wakely <jwak...@redhat.com> Date: Fri Mar 28 15:41:41 2025 +0000 libstdc++: Fix -Wstringop-overread warning in std::vector<bool> [PR114758] As in r13-4393-gcca06f0d6d76b0 and a few other commits, we can avoid bogus warnings in std::vector<bool> by hoisting some loads to before the allocation that calls operator new. This means that the compiler has enough info to remove the dead branches that trigger bogus warnings. On trunk this is only needed with -fno-assume-sane-operators-new-delete but it will help on the branches where that option doesn't exist. libstdc++-v3/ChangeLog: PR libstdc++/114758 * include/bits/vector.tcc (vector<bool, A>::_M_fill_insert): Hoist loads of begin() and end() before allocation. * testsuite/23_containers/vector/bool/capacity/114758.cc: New test. Reviewed-by: Tomasz KamiÅski <tkami...@redhat.com>