This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/46424] Iterators being improperly invalidated
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 11 Nov 2010 09:30:45 +0000
- Subject: [Bug libstdc++/46424] Iterators being improperly invalidated
- Auto-submitted: auto-generated
- References: <bug-46424-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46424
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2010-11-11 09:30:40 UTC ---
(In reply to comment #1)
> I forgot to mention one thing. The code that seems to acting suspisciously is
> this bit:
>
> toDo.erase( *out ); //Putting this code here instead of the end breaks this
> code.
This invalidates out.
> std::map<PublicKey, std::set<PublicKey> >::const_iterator giter = graph.find(
> *out );
And now you dereference an invalid iterator.
This looks clearly broken to me, but I have only looked briefly. Please follow
GCC's bug reporting guidelines and provide a self-contained testcase without
other libraries - I'm not going to download and install them. Provide
preprocessed source if you really can't remove them.
Please also try compiling with -D_GLIBCXX_DEBUG, or changing the type of toDo
to __gnu_debug::set<PublicKey>, after including <debug/set>, which might tell
you the problem.