This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [Bug libstdc++/89608] Undetected iterator invalidations on unordered containers in debug mode
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: François Dumont <frs dot dumont at gmail dot com>
- Cc: "libstdc++ at gcc dot gnu dot org" <libstdc++ at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 7 Mar 2019 23:57:54 +0000
- Subject: Re: [Bug libstdc++/89608] Undetected iterator invalidations on unordered containers in debug mode
- References: <bug-89608-19885@http.gcc.gnu.org/bugzilla/> <bug-89608-19885-hxU7fWXMIN@http.gcc.gnu.org/bugzilla/> <6651b2a3-5792-a716-1f2f-ef65b40784da@gmail.com>
On 07/03/19 22:22 +0100, François Dumont wrote:
Hi
I consider the implementation to decide to invalidate iterators or
not. As nodes are not deallocated and only slghtly impacted during the
rehash process I consider that they shouldn't be invalidated appart
from the local iterators. I should have just consider the Standard.
Here is the complete patch which is Max Sistemich proposal but
extended to the other unordered containers with also the test adapted
for the testsuite.
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.
I run all unordered tests so far in Debug mode. I have 4 unrelated
failures that I'll fix through another patch. Ok to commit once all
tests run ?
Yes, this is OK for trunk, thanks!