static object constructor bug.

Paul Kendall paul@orion.co.nz
Wed Nov 19 19:11:00 GMT 1997


Hi, heres a really obscure bug to do with static object constructors.
I am using an sgi-irix5.3 system.  This bug appears in gcc-2.7.2.1
and egcs-971114.

I assume that this will occur for other systems.  I don't really have
one to try it on.

class B {
public:
	B() {}
	~B() {}
};

class A {
public:
	A();
	~A();
protected:
	static B b;
};

B A::b;
A::A() {
}

A::~A() {
}

nm -B t.o | grep GLOB
000000b8 T _GLOBAL_$D$_1A$b
00000001 D _GLOBAL_$F$_1A$b
0000011c T _GLOBAL_$I$_1A$b

when B A::b; moved after A::A()

nm -B t.o | grep GLOB
000000b8 T _GLOBAL_$D$__1A
00000001 D _GLOBAL_$F$__1A
0000011c T _GLOBAL_$I$__1A


Cheers,
Paul Kendall
Product Development Manager
Orion Systems New Zealand Ltd




More information about the Gcc-bugs mailing list