aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/cpp
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2025-03-28 15:41:41 +0000
committerJonathan Wakely <redi@gcc.gnu.org>2025-03-31 22:54:08 +0100
commitaa3aaf2bfb8fcc17076993df4297597b68bc5f60 (patch)
tree086cdf4d8b43a4605a9bc0d5e99464f30d1ce895 /gcc/testsuite/gcc.dg/cpp
parent1f6c19f307c8de9830130a0ba071c24e3835beb3 (diff)
downloadgcc-aa3aaf2bfb8fcc17076993df4297597b68bc5f60.zip
gcc-aa3aaf2bfb8fcc17076993df4297597b68bc5f60.tar.gz
gcc-aa3aaf2bfb8fcc17076993df4297597b68bc5f60.tar.bz2
libstdc++: Fix -Warray-bounds warning in std::vector<bool> [PR110498]
In this case, we need to tell the compiler that the current size is not larger than the new size so that all the existing elements can be copied to the new storage. This avoids bogus warnings about overflowing the new storage when the compiler can't tell that that cannot happen. We might as well also hoist the loads of begin() and end() before the allocation too. All callers will have loaded at least begin() before calling _M_reallocate. libstdc++-v3/ChangeLog: PR libstdc++/110498 * include/bits/vector.tcc (vector<bool, A>::_M_reallocate): Hoist loads of begin() and end() before allocation and use them to state an unreachable condition. * testsuite/23_containers/vector/bool/capacity/110498.cc: New test. Reviewed-by: Tomasz KamiƄski <tkaminsk@redhat.com>
Diffstat (limited to 'gcc/testsuite/gcc.dg/cpp')
0 files changed, 0 insertions, 0 deletions