Ok I looked into the corresponding gcc stl function and it seems that the debug function checks if the iterator is incrementable. I haven't checked the macro that performs this check but the iterator might be marked as invalid after an element has been erased. So this crash will only happen during a debug build, but I think it is good to know that during a debug build some additional checks are performed.<br>
<br>the relevant code is:<br><br> _Safe_iterator&<br> operator++()<br> {<br> _GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(),<br> _M_message(__msg_bad_inc)<br> ._M_iterator(*this, "this"));<br>
++_M_current;<br> return *this;<br> }<br><br>I still don't understand why it fails with my patch but this might be because it is not delivered correctly. I'll push a patch based on your idea to master.<br>
<br><div class="gmail_quote">2011/6/21 Noel Power <span dir="ltr"><<a href="mailto:nopower@novell.com" target="_blank">nopower@novell.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>On 21/06/11 18:52, Markus Mohrhard wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I did a debug build. And I had some stl debug symbols in my backtrace so it might be that perhaps the compiler won't optimize this out.<br>
<br>
I attached the backtrace.<br>
<br>
print it shows: it = {<__gnu_debug::_Safe_iterator_<u></u>base> = {_M_sequence = 0x29e3678, _M_version = 0, _M_prior = 0x0, _M_next = 0x0}, _M_current = {_M_current = 0x2a27bf0}}<br>
</blockquote></div>
ah, ok -D_GLIBCXX_DEBUG is enabled, right I tried to build some stuff partially ( with some extra debug flags etc. ) <sigh> didn't work ( link problems ) I will try a full debug build ( have never done that up to now )<br>
<font color="#888888">
<br>
Noel<br>
</font></blockquote></div><br>