[Bug libstdc++/54296] using the object in the map to erase element from the map crashes

fdumont at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Sep 5 19:41:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54296

--- Comment #9 from François Dumont <fdumont at gcc dot gnu.org> 2012-09-05 19:41:21 UTC ---
Author: fdumont
Date: Wed Sep  5 19:41:16 2012
New Revision: 190991

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=190991
Log:
2012-09-05  François Dumont  <fdumont@gcc.gnu.org>

    PR libstdc++/54296
    * include/bits/hashtable.h (_M_erase(size_type, __node_base*,
    __node_type*)): New.
    (erase(const_iterator)): Use latter.
    (_M_erase(std::true_type, const key_type&)): New, likewise.
    (_M_erase(std::false_type, const key_type&)): New. Find all nodes
    matching the key before deallocating them so that the key doesn't
    get invalidated.
    (erase(const key_type&)): Use the new member functions.
    * testsuite/23_containers/unordered_map/erase/54296.cc: New.
    * testsuite/23_containers/unordered_multimap/erase/54296.cc: New.

Added:
    trunk/libstdc++-v3/testsuite/23_containers/unordered_map/erase/54276.cc
   
trunk/libstdc++-v3/testsuite/23_containers/unordered_multimap/erase/54276.cc
Modified:
    trunk/libstdc++-v3/ChangeLog
    trunk/libstdc++-v3/include/bits/hashtable.h



More information about the Gcc-bugs mailing list