<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[std::deque::push_back crasht mit segfault]]></title><description><![CDATA[<p>Hi,</p>
<p>ich versuche mich gerade an einem Befunge-93 Interpreter.<br />
Soweit so gut, und auf einmal gibt es einen Segfault beim <code>push_back()</code> der deque meines <code>std::stack</code> s.</p>
<p><strong>Hat jemand eine Idee, woran es liegen könnte?</strong> Hier crasht es:</p>
<pre><code class="language-cpp">push_back(const value_type&amp; __x)
      {
	if (this-&gt;_M_impl._M_finish._M_cur
	    != this-&gt;_M_impl._M_finish._M_last - 1)
	  {
	    this-&gt;_M_impl.construct(this-&gt;_M_impl._M_finish._M_cur, __x);///&lt;- Hier!
</code></pre>
<p>Wenn Code benötigt wird, liefere ich gerne die zusammenkopierte Version auf <a href="http://Ideone.com" rel="nofollow">Ideone.com</a>. Ich stelle sie noch nicht bereit, weil ich sicher bin, dass der Code nicht helfen wird, <strong>ich würde erstmal Vorschläge haben wollen woran es liegen könnte, vielleicht kommt mir dann ein Gedankenblitz.</strong></p>
<p>MfG und danke im Voraus.</p>
<p>P.S.: Ich kann mir nicht im geringsten Vorstellen, wie <code>deque::push_back</code> streiken könnte... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f62e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_open_mouth"
      title=":open_mouth:"
      alt="😮"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/308757/std-deque-push_back-crasht-mit-segfault</link><generator>RSS for Node</generator><lastBuildDate>Wed, 05 Aug 2026 15:15:18 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/308757.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 04 Oct 2012 16:34:55 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to std::deque::push_back crasht mit segfault on Thu, 04 Oct 2012 16:34:55 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>ich versuche mich gerade an einem Befunge-93 Interpreter.<br />
Soweit so gut, und auf einmal gibt es einen Segfault beim <code>push_back()</code> der deque meines <code>std::stack</code> s.</p>
<p><strong>Hat jemand eine Idee, woran es liegen könnte?</strong> Hier crasht es:</p>
<pre><code class="language-cpp">push_back(const value_type&amp; __x)
      {
	if (this-&gt;_M_impl._M_finish._M_cur
	    != this-&gt;_M_impl._M_finish._M_last - 1)
	  {
	    this-&gt;_M_impl.construct(this-&gt;_M_impl._M_finish._M_cur, __x);///&lt;- Hier!
</code></pre>
<p>Wenn Code benötigt wird, liefere ich gerne die zusammenkopierte Version auf <a href="http://Ideone.com" rel="nofollow">Ideone.com</a>. Ich stelle sie noch nicht bereit, weil ich sicher bin, dass der Code nicht helfen wird, <strong>ich würde erstmal Vorschläge haben wollen woran es liegen könnte, vielleicht kommt mir dann ein Gedankenblitz.</strong></p>
<p>MfG und danke im Voraus.</p>
<p>P.S.: Ich kann mir nicht im geringsten Vorstellen, wie <code>deque::push_back</code> streiken könnte... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f62e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_open_mouth"
      title=":open_mouth:"
      alt="😮"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2257087</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2257087</guid><dc:creator><![CDATA[Sone]]></dc:creator><pubDate>Thu, 04 Oct 2012 16:34:55 GMT</pubDate></item><item><title><![CDATA[Reply to std::deque::push_back crasht mit segfault on Thu, 04 Oct 2012 16:39:28 GMT]]></title><description><![CDATA[<p>Copy Ctor?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2257089</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2257089</guid><dc:creator><![CDATA[Kellerautomat]]></dc:creator><pubDate>Thu, 04 Oct 2012 16:39:28 GMT</pubDate></item><item><title><![CDATA[Reply to std::deque::push_back crasht mit segfault on Thu, 04 Oct 2012 16:42:18 GMT]]></title><description><![CDATA[<p>Kellerautomat schrieb:</p>
<blockquote>
<p>Copy Ctor?</p>
</blockquote>
<p>Die zu haltenden Elemente sind <code>unsigned long long</code> s <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /><br />
Vergessen zu erwähnen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2257092</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2257092</guid><dc:creator><![CDATA[Sone]]></dc:creator><pubDate>Thu, 04 Oct 2012 16:42:18 GMT</pubDate></item><item><title><![CDATA[Reply to std::deque::push_back crasht mit segfault on Thu, 04 Oct 2012 16:42:26 GMT]]></title><description><![CDATA[<p>zerschossener heap? valgrind und debugger können helfen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2257094</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2257094</guid><dc:creator><![CDATA[otze_logout]]></dc:creator><pubDate>Thu, 04 Oct 2012 16:42:26 GMT</pubDate></item><item><title><![CDATA[Reply to std::deque::push_back crasht mit segfault on Thu, 04 Oct 2012 16:43:22 GMT]]></title><description><![CDATA[<p>Zeig die Codestelle , wo du push_back aufrufst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2257095</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2257095</guid><dc:creator><![CDATA[eingabe]]></dc:creator><pubDate>Thu, 04 Oct 2012 16:43:22 GMT</pubDate></item><item><title><![CDATA[Reply to std::deque::push_back crasht mit segfault on Thu, 04 Oct 2012 16:52:27 GMT]]></title><description><![CDATA[<p>Sone schrieb:</p>
<blockquote>
<p>Wenn Code benötigt wird, liefere ich gerne die zusammenkopierte Version auf <a href="http://Ideone.com" rel="nofollow">Ideone.com</a>. Ich stelle sie noch nicht bereit, weil ich sicher bin, dass der Code nicht helfen wird</p>
</blockquote>
<p>Anders gesagt, du bist dir absolut sicher, dass der Fehler nicht bei dir sondern bei der Bibliothek liegt? Dann viel Spaß beim allein weitersuchen.<br />
Mein erster Reflex war, dich auf den zweiten Link in meiner Signatur hinzuweisen, aber wenn du uns absichtlich keine Infos liefern willst, warum sollten wir dir dann noch helfen wollen?</p>
<p>So allmählich müsstest du doch wissen, wies hier abläuft oder nicht?</p>
<p>PS: wenn du schon ins push_back reindebuggst, warum nicht auch noch ins construct?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2257096</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2257096</guid><dc:creator><![CDATA[pumuckl]]></dc:creator><pubDate>Thu, 04 Oct 2012 16:52:27 GMT</pubDate></item><item><title><![CDATA[Reply to std::deque::push_back crasht mit segfault on Thu, 04 Oct 2012 17:09:48 GMT]]></title><description><![CDATA[<p>pumuckl schrieb:</p>
<blockquote>
<p>Sone schrieb:</p>
<blockquote>
<p>Wenn Code benötigt wird, liefere ich gerne die zusammenkopierte Version auf <a href="http://Ideone.com" rel="nofollow">Ideone.com</a>. Ich stelle sie noch nicht bereit, weil ich sicher bin, dass der Code nicht helfen wird</p>
</blockquote>
<p>Anders gesagt, du bist dir absolut sicher, dass der Fehler nicht bei dir sondern bei der Bibliothek liegt? Dann viel Spaß beim allein weitersuchen.</p>
</blockquote>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /><br />
<a href="http://ideone.com/L0uTV" rel="nofollow">http://ideone.com/L0uTV</a><br />
Der Segfault beginnt bei Z. 150 ( <code>push</code> ).</p>
<p>Deklaration des <code>stack</code> s ist weiter oben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2257108</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2257108</guid><dc:creator><![CDATA[Sone]]></dc:creator><pubDate>Thu, 04 Oct 2012 17:09:48 GMT</pubDate></item><item><title><![CDATA[Reply to std::deque::push_back crasht mit segfault on Thu, 04 Oct 2012 17:12:37 GMT]]></title><description><![CDATA[<p>Unglaublich! Ich glaube ich hab den Fehler!<br />
Tatsächlich ist die Größe des Stacks beim Aufruf 0. Allerdings hatte ich das ausgeschlossen, weil ich dachte, dass zum Zeitpunkt des Aufrufs von <code>push_back</code> das <code>top()</code> vom Stack und damit das <code>back()</code> der <code>deque</code> sonst etwas geworfen hätten (da das <code>top()</code> vorher ausgewertet und damit aufgerufen wurde).</p>
<p>Ich seh mal weiter, danke schon mal.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2257109</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2257109</guid><dc:creator><![CDATA[Sone]]></dc:creator><pubDate>Thu, 04 Oct 2012 17:12:37 GMT</pubDate></item><item><title><![CDATA[Reply to std::deque::push_back crasht mit segfault on Thu, 04 Oct 2012 17:15:00 GMT]]></title><description><![CDATA[<p>Und wenn du stack.top() vorher in eine Variable rettest, bevor du sie pusht?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2257110</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2257110</guid><dc:creator><![CDATA[fghfgh]]></dc:creator><pubDate>Thu, 04 Oct 2012 17:15:00 GMT</pubDate></item><item><title><![CDATA[Reply to std::deque::push_back crasht mit segfault on Thu, 04 Oct 2012 17:19:50 GMT]]></title><description><![CDATA[<p>LOL, es war ein semantischer Fehler meines Interpreters - der ':' Befehl bedeutet bei Befunge, dass wen der Stack leer ist, Zwei Nullen reingepusht werden (welchen Sinn auch immer das haben mag).</p>
<p>@fghfgh: Probier ich gleich aus.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2257112</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2257112</guid><dc:creator><![CDATA[Sone]]></dc:creator><pubDate>Thu, 04 Oct 2012 17:19:50 GMT</pubDate></item><item><title><![CDATA[Reply to std::deque::push_back crasht mit segfault on Thu, 04 Oct 2012 17:21:38 GMT]]></title><description><![CDATA[<p>fghfgh schrieb:</p>
<blockquote>
<p>Und wenn du stack.top() vorher in eine Variable rettest, bevor du sie pusht?</p>
</blockquote>
<p>Jo, dann crasht er bei der Initialisierung, thx <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<p>Komisch ist aber, dass er nix wirft <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2257113</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2257113</guid><dc:creator><![CDATA[Sone]]></dc:creator><pubDate>Thu, 04 Oct 2012 17:21:38 GMT</pubDate></item><item><title><![CDATA[Reply to std::deque::push_back crasht mit segfault on Thu, 04 Oct 2012 17:22:18 GMT]]></title><description><![CDATA[<p>war auch meine erste Intuition, dass der Stack leer sein könnte. Danach dachte ich mir, dass du das sicher gecheckt hast und hab mir schon überlgt, ob es irgendwelche Möglichkeiten gibt, top() durch das push() zu invalidieren(sowas geht bei einem vektor zum Beispiel, wenn die Implementation des vektors einen kleinen Fehler hat: vektor.push_back(vektor.back()) ). Gut, dass es in diesem Fall keinen Fehler in der stl gab <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2257114</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2257114</guid><dc:creator><![CDATA[otze_logout]]></dc:creator><pubDate>Thu, 04 Oct 2012 17:22:18 GMT</pubDate></item></channel></rss>