[Bug libstdc++/89608] Undetected iterator invalidations on unordered containers in debug mode
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89608 Jonathan Wakely changed: What|Removed |Added Resolution|--- |FIXED Status|ASSIGNED|RESOLVED Target Milestone|--- |9.0 --- Comment #3 from Jonathan Wakely --- This was fixed for GCC 9.1
[Bug libstdc++/89608] Undetected iterator invalidations on unordered containers in debug mode
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89608 Richard Biener changed: What|Removed |Added Status|NEW |ASSIGNED
[Bug libstdc++/89608] Undetected iterator invalidations on unordered containers in debug mode
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89608 --- Comment #2 from François Dumont --- Author: fdumont Date: Fri Mar 8 05:37:50 2019 New Revision: 269478 URL: https://gcc.gnu.org/viewcvs?rev=269478=gcc=rev Log: 2019-03-08 François Dumont PR libstdc++/89608 * include/debug/unordered_map (unordered_map<>::_M_check_rehashed): Invalidate all iterators in case of rehash. (unordered_multimap<>::_M_check_rehashed): Likewise. * include/debug/unordered_set (unordered_set<>::_M_check_rehashed): Likewise. (unordered_multiset<>::_M_check_rehashed): Likewise. * testsuite/23_containers/unordered_set/debug/89608_neg.cc: New. Added: trunk/libstdc++-v3/testsuite/23_containers/unordered_set/debug/89608_neg.cc Modified: trunk/libstdc++-v3/ChangeLog trunk/libstdc++-v3/include/debug/unordered_map trunk/libstdc++-v3/include/debug/unordered_set
[Bug libstdc++/89608] Undetected iterator invalidations on unordered containers in debug mode
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89608 Jonathan Wakely changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2019-03-06 CC||fdumont at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from Jonathan Wakely --- François, could you take a look please? The standard says: > The insert and emplace members shall not affect the validity of iterators if > (N+n) <= z * B, where N is the number of elements in the container prior to > the insert operation, n is the number of elements inserted, B is the > container’s bucket count, and z is the container’s maximum load factor. The insertion does rehash, so should invalidate the iterators. It looks like the _M_check_rehashed function only invalidates local iterators, despite the order of elements changing.