aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2023-07-26 14:09:24 +0100
committerJonathan Wakely <jwakely@redhat.com>2023-07-26 17:02:46 +0100
commit7931a1de9ec87b996d51d3d60786f5c81f63919f (patch)
treed7f6894dad6e32f22f03dbb82d4abe6b595f98c2 /gcc
parentc01b344e814001e07fd304ce98d013d811e90192 (diff)
downloadgcc-7931a1de9ec87b996d51d3d60786f5c81f63919f.zip
gcc-7931a1de9ec87b996d51d3d60786f5c81f63919f.tar.gz
gcc-7931a1de9ec87b996d51d3d60786f5c81f63919f.tar.bz2
libstdc++: Avoid bogus overflow warnings in std::vector<bool> [PR110807]
GCC thinks the allocation can alter the object being copied if it's globally reachable, so doesn't realize that [x.begin(), x.end()) after the allocation is the same as x.size() before it. This causes a testsuite failure when testing with -D_GLIBCXX_DEBUG: FAIL: 23_containers/vector/bool/swap.cc (test for excess errors) A fix is to move the calls to x.begin() and x.end() to before the allocation. A similar problem exists in vector<bool>::_M_insert_range where *this is globally reachable, as reported in PR libstdc++/110807. That can also be fixed by moving calls to begin() and end() before the allocation. libstdc++-v3/ChangeLog: PR libstdc++/110807 * include/bits/stl_bvector.h (vector(const vector&)): Access iterators before allocating. * include/bits/vector.tcc (vector<bool>::_M_insert_range): Likewise. * testsuite/23_containers/vector/bool/110807.cc: New test.
Diffstat (limited to 'gcc')
0 files changed, 0 insertions, 0 deletions