[Bug libstdc++/89608] Undetected iterator invalidations on unordered containers in debug mode

François Dumont frs.dumont@gmail.com
Thu Mar 7 21:22:00 GMT 2019


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 ?

François

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 89608.patch
Type: text/x-patch
Size: 2842 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20190307/007af18c/attachment.bin>


More information about the Libstdc++ mailing list