Boost C++ Libraries: Ticket #852: Problem with Boost and GCC 4.1 https://svn.boost.org/trac10/ticket/852 <pre class="wiki"> There is a problem when using slots &amp; trackable with GCC 4.1 - I don't know whether this is a GCC problem or a Boost problem, but it affects us (OpenWengo) on both Fedora Core and Feisty, since both distribute gcc 4.1. I'm attaching a test case - the expected output is: create A fire SGN A create B fire SGN A B delete A fire SGN B delete B fire SGN exit This doesn't happen :) </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/852 Trac 1.4.3 nobody Tue, 13 Mar 2007 16:12:00 GMT <link>https://svn.boost.org/trac10/ticket/852#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/852#comment:1</guid> <description> <pre class="wiki">Logged In: NO For reference, this bug has been opened against Ubuntu: https://launchpad.net/ubuntu/+source/gcc-4.1/+bug/75724 and OpenSuse: https://bugzilla.novell.com/show_bug.cgi?id=228524 Dave. </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>cepstein</dc:creator> <pubDate>Tue, 13 Mar 2007 16:35:40 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/852#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/852#comment:2</guid> <description> <pre class="wiki">Logged In: YES user_id=36183 Originator: NO When you say "this doesn't happen", what *does* happen? Different output? A crash? Please be more specific. Also, what version of Boost are you using? I believe there has been at least one bug-fix to the signals library since 1.33.0, though I'm not sure if it is related: http://boost.cvs.sourceforge.net/boost/boost/boost/signals/signal_template.hpp?r1=1.17&amp;r2=1.17.2.1 Your test works for me on Ubuntu 6.06-LTS with Boost CVS as/of 2006-08-11 and these versions of gcc: gcc version 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5) gcc version 4.1.2 I don't think this is a gcc bug. </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>nobody</dc:creator> <pubDate>Tue, 13 Mar 2007 16:50:49 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/852#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/852#comment:3</guid> <description> <pre class="wiki">Logged In: NO What actually happens is undefined - you get jibberish after deleting A. It should select the slot B, but that doesn't happen. Second info: this has also been created against GCC: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31164 </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>nobody</dc:creator> <pubDate>Tue, 13 Mar 2007 16:58:05 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/852#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/852#comment:4</guid> <description> <pre class="wiki">Logged In: NO As I said in a previous comment, what happens is indeterminate. On one run, you get this: http://phpfi.com/215193 The Boost version is a 1.33 - the one which comes with Edgy. From http://packages.ubuntu.com/edgy/libs/ it looks to be 1.33.1. Dave. </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>ficuz</dc:creator> <pubDate>Tue, 13 Mar 2007 17:05:24 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/852#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/852#comment:5</guid> <description> <pre class="wiki">Logged In: YES user_id=344328 Originator: NO I have this bug with Ubuntu/Edgy: boost 1.33.1-7ubuntu1 and gcc (GCC) 4.1.2 20060928 (prerelease) (Ubuntu 4.1.1-13ubuntu5) Ludovico </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>gladiac</dc:creator> <pubDate>Tue, 13 Mar 2007 17:12:22 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/852#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/852#comment:6</guid> <description> <pre class="wiki">Logged In: YES user_id=880725 Originator: NO The problem exists here with boost-1.33.1 and gcc (GCC) 4.1.2 20061115 (prerelease) (SUSE Linux) Output: ----------------- Starting program: /home/gladiac/workspace/tmp/testcase/a.out create A fire SGN A create B fire SGN A B delete A fire SGN A1��`�`ȱ`A�`�`AP�`�`�u��*p�`p�`!PL���*P�`1B!PL���*�`1 �`p�`��`10�`0�`Ȳ`!д`0�`A�`X�`P�`��`�`1d@�I@�`�:@!� @�`AP�`��`�u��*0�`0�`1��`1 �`p�`�`1!0�`AX�`��`�`�`@�`1d@�I@p�`�:@!� @0�`� Program exited normally. </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>tzlaine</dc:creator> <pubDate>Tue, 13 Mar 2007 20:51:49 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/852#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/852#comment:7</guid> <description> <pre class="wiki">Logged In: YES user_id=729903 Originator: NO I have verified this with gcc 4.1.0 (SuSE Linux), compiled and linked against Boost 1.33.1, then Boost 1.34 from a couple of moths ago. It fails for both versions of Boost. If I add "A = new Test("C", mySgn); B = new Test("D", mySgn);" right before "std::cerr &lt;&lt; "fire SGN" &lt;&lt; std::endl;", it segfaults nearly every time for me on the last mySgn() call. </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>bk12</dc:creator> <pubDate>Wed, 14 Mar 2007 23:23:10 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/852#comment:8 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/852#comment:8</guid> <description> <pre class="wiki">Logged In: YES user_id=116622 Originator: NO Here is an even simpler test case: when build with gcc 4.0 it outputs "Success", with gcc 4.1 it will output "Failure". ---- #include &lt;iostream&gt; #include &lt;boost/signal.hpp&gt; #include &lt;boost/bind.hpp&gt; #include &lt;stdlib.h&gt; class SomeObject : public boost::signals::trackable { public: void function() { std::cerr &lt;&lt; "Failure\n"; exit(1); } }; int main() { SomeObject* obj = new SomeObject; boost::signal&lt;void ()&gt; signal; signal.connect(boost::bind(&amp;SomeObject::function, obj)); delete obj; signal(); std::cerr &lt;&lt; "Success\n"; return 0; } ---- </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>Marshall Clow</dc:creator> <pubDate>Thu, 12 Jul 2007 15:16:46 GMT</pubDate> <title>owner, status changed; severity set https://svn.boost.org/trac10/ticket/852#comment:9 https://svn.boost.org/trac10/ticket/852#comment:9 <ul> <li><strong>owner</strong> changed from <span class="trac-author">Douglas Gregor</span> to <span class="trac-author">doug_gregor</span> </li> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">new</span> </li> <li><strong>severity</strong> → <span class="trac-field-new">Showstopper</span> </li> </ul> <p> Assigned to "doug_gregor" instead of nonexistent user "dgregor" </p> Ticket anonymous Mon, 16 Jul 2007 21:05:53 GMT <link>https://svn.boost.org/trac10/ticket/852#comment:10 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/852#comment:10</guid> <description> <p> What's the status of this bug? Is it fixed in 1.34? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Daryle Walker</dc:creator> <pubDate>Mon, 27 Aug 2007 22:48:43 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/852 https://svn.boost.org/trac10/ticket/852 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">test-gcc-boost.cc</span> </li> </ul> <p> Sample file copied from the <a class="missing wiki">SourceForge</a> version of this ticket </p> Ticket Daryle Walker Mon, 27 Aug 2007 22:50:14 GMT component changed https://svn.boost.org/trac10/ticket/852#comment:11 https://svn.boost.org/trac10/ticket/852#comment:11 <ul> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">signals</span> </li> </ul> Ticket Douglas Gregor Tue, 29 Apr 2008 18:29:36 GMT owner, description changed https://svn.boost.org/trac10/ticket/852#comment:12 https://svn.boost.org/trac10/ticket/852#comment:12 <ul> <li><strong>owner</strong> changed from <span class="trac-author">doug_gregor</span> to <span class="trac-author">Douglas Gregor</span> </li> <li><strong>description</strong> modified (<a href="/trac10/ticket/852?action=diff&amp;version=12">diff</a>) </li> </ul> Ticket anonymous Fri, 13 Feb 2009 15:35:32 GMT <link>https://svn.boost.org/trac10/ticket/852#comment:13 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/852#comment:13</guid> <description> <p> Sorry for being impatient, but are there any news or any help needed? I'm using openSUSE-11.1 </p> <blockquote> <p> boost-1.36.0 gcc (SUSE Linux) 4.3.2 [gcc-4_3-branch revision 141291] </p> </blockquote> <p> The bug is still there. E.g the button_click.cpp example in svn fails printing two time 'OK!'. </p> </description> <category>Ticket</category> </item> <item> <author>Michael Andres <ma@…></author> <pubDate>Mon, 16 Feb 2009 17:24:59 GMT</pubDate> <title>cc set https://svn.boost.org/trac10/ticket/852#comment:14 https://svn.boost.org/trac10/ticket/852#comment:14 <ul> <li><strong>cc</strong> <span class="trac-author">ma@…</span> added </li> </ul> <p> In case someone is listening: Is this really a linux/gcc problem? I'm asking because I don't see how/where the test could happen. (boost-1.36.0) </p> <p> Looking at the slot ctor, neither get_inspectable_slot() nor the detail::bound_objects_visitor (trackable.hpp) seem to handle the case of a bound pointer to to member function. </p> <p> If I'd add a few more decode() overloads to class bound_objects_visitor, I could catch those cases: </p> <pre class="wiki"> template&lt;class R, class T, class LT&gt; void decode(const _bi::bind_t&lt;R,_mfi::cmf0&lt;R,T&gt;, _bi::list1&lt;LT&gt; &gt; &amp; t, int) const {;} template&lt;class R, class T, class A1, class LT, class L1&gt; void decode(const _bi::bind_t&lt;R,_mfi::cmf1&lt;R,T,A1&gt;, _bi::list2&lt;LT,L1&gt; &gt; &amp; t, int) const {;} ... </pre><p> But I can't extract the 1st arg of the bind_t internal list in order to check whether it's a pointer of reference to a trackable seems to be a private member of bind_t). </p> <p> May it be it's not a compiler problem, but simply not implemented? </p> Ticket Daniel James Wed, 13 May 2009 07:47:35 GMT status, resolution changed https://svn.boost.org/trac10/ticket/852#comment:15 https://svn.boost.org/trac10/ticket/852#comment:15 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">fixed</span> </li> </ul> <p> I tried this on Ubuntu and it seems to have been fixed in 1.34.0. The output below shows it failing on 1.33.1 and passing on 1.34.0 </p> <pre class="wiki">daniel@bah:~$ ./boost_1_33_1/bin.v2/libs/signals/example/gcc-4.1/debug/test-gcc-boost create A fire SGN A create B fire SGN A B delete A fire SGN A??R ?R ??R !(?R H?R BR !(?R ??R ~T?`?R `?R ??P?R ??R ??R D?R ??R &lt;?R ??R X?R ?R ??R !??R ??R P?R p?R ?R ???R ?^?R !(?R x?R ~T?8?R 8?R ??(?R ??R ??R &lt;?R ??R !??R ??R (?R H?R ? daniel@bah:~$ ./boost_1_34_0/bin.v2/libs/signals/example/gcc-4.1/debug/test-gcc-boost create A fire SGN A create B fire SGN A B delete A fire SGN B delete B fire SGN exit </pre> Ticket