Opened 16 years ago

Last modified 13 years ago

#852 closed Bugs (fixed)

Problem with Boost and GCC 4.1 — at Version 12

Reported by: nobody Owned by: Douglas Gregor
Milestone: Component: signals
Version: None Severity: Showstopper
Keywords: Cc: ma@…

Description (last modified by Douglas Gregor)

There is a problem when using slots & 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 :) 

Change History (13)

comment:1 by nobody, 16 years ago

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.

comment:2 by cepstein, 16 years ago

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&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.

comment:3 by nobody, 16 years ago

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

comment:4 by nobody, 16 years ago

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.

comment:5 by ficuz, 16 years ago

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

comment:6 by gladiac, 16 years ago

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.

comment:7 by tzlaine, 16 years ago

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 << "fire SGN" << std::endl;", it segfaults nearly every time for me on the last mySgn() call.

comment:8 by bk12, 16 years ago

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 <iostream>
#include <boost/signal.hpp>
#include <boost/bind.hpp>

#include <stdlib.h>

class SomeObject : public boost::signals::trackable {
public:
	void function() {
		std::cerr << "Failure\n";
		exit(1);
	}
};

int main() {
	SomeObject* obj = new SomeObject;
	boost::signal<void ()> signal;
	signal.connect(boost::bind(&SomeObject::function, obj));
	delete obj;
	signal();

	std::cerr << "Success\n";
	return 0;
}
----

comment:9 by Marshall Clow, 15 years ago

Owner: changed from Douglas Gregor to doug_gregor
Severity: Showstopper
Status: assignednew

Assigned to "doug_gregor" instead of nonexistent user "dgregor"

comment:10 by anonymous, 15 years ago

What's the status of this bug? Is it fixed in 1.34?

by Daryle Walker, 15 years ago

Attachment: test-gcc-boost.cc added

Sample file copied from the SourceForge version of this ticket

comment:11 by Daryle Walker, 15 years ago

Component: Nonesignals

comment:12 by Douglas Gregor, 14 years ago

Description: modified (diff)
Owner: changed from doug_gregor to Douglas Gregor
Note: See TracTickets for help on using tickets.