This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Global constructor problem on mips-sgi-irix5.2
- To: egcs at cygnus dot com, egcs-bugs at cygnus dot com
- Subject: Global constructor problem on mips-sgi-irix5.2
- From: Fred Richardson <frichard at bbn dot com>
- Date: Mon, 6 Apr 1998 12:13:07 -0400
- Reply-to: frichard at bbn dot com
Hi-
It looks like constructors for global objects aren't called on my
mips-sgi-irix5.2 box when using egcs-1.0.2.
The following program:
#include <iostream.h>
#include <stdlib.h>
#include <stdio.h>
class Foo
{
private:
int a_int;
float a_flt;
public:
Foo () :
a_int(1234), a_flt(56.78) {};
void print()
{
fprintf(stdout, "Foo: a_int=%d, a_flt=%g\n",
a_int, a_flt);
fflush(stdout);
}
void set(int _a_int, float _a_flt)
{
a_int = _a_int;
a_flt = _a_flt;
}
};
Foo the_foo;
int main(int argc, char* argv[])
{
the_foo.print();
the_foo.set(4321, 87.65);
the_foo.print();
}
compiled the following way:
% g++ -v -Wall -o main -v main.cc
Reading specs from /d4mutl/bybrad/lib/gcc-lib/mips-sgi-irix5.2/egcs-2.90.27/specs
gcc version egcs-2.90.27 980315 (egcs-1.0.2 release)
/d4mutl/bybrad/lib/gcc-lib/mips-sgi-irix5.2/egcs-2.90.27/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=90 -Dunix -Dmips -Dsgi -Dhost_mips -DMIPSEB -D_MIPSEB -DSYSTYPE_SVR4 -D_SVR4_SOURCE -D_MODERN_C -D__DSO__ -D_MIPS_SIM=_MIPS_SIM_ABI32 -D_MIPS_SZPTR=32 -D__unix__ -D__mips__ -D__sgi__ -D__host_mips__ -D__MIPSEB__ -D_MIPSEB -D__SYSTYPE_SVR4__ -D_SVR4_SOURCE -D_MODERN_C -D__DSO__ -D_MIPS_SIM=_MIPS_SIM_ABI32 -D_MIPS_SZPTR=32 -D__unix -D__mips -D__sgi -D__host_mips -D__MIPSEB -D__SYSTYPE_SVR4 -Asystem(unix) -Asystem(svr4) -Acpu(mips) -Amachine(sgi) -D__EXCEPTIONS -D__CHAR_UNSIGNED__ -Wall -D__LANGUAGE_C_PLUS_PLUS -D_LANGUAGE_C_PLUS_PLUS -D__SIZE_TYPE__=unsigned int -D__PTRDIFF_TYPE__=int -D__EXTENSIONS__ -D_SGI_SOURCE -D_LONGLONG -D_MIPS_FPSET=16 -D_MIPS_ISA=_MIPS_ISA_MIPS1 -D_MIPS_SZINT=32 -D_MIPS_SZLONG=32 main.cc /var/tmp/cca0040A.ii
GNU CPP version egcs-2.90.27 980315 (egcs-1.0.2 release) [AL 1.1, MM 40] SGI running IRIX 5.x
#include "..." search starts here:
#include <...> search starts here:
/d4mutl/bybrad/include/g++
/usr/local/include
/d4mutl/bybrad/mips-sgi-irix5.2/include
/d4mutl/bybrad/lib/gcc-lib/mips-sgi-irix5.2/egcs-2.90.27/include
/usr/include
End of search list.
/d4mutl/bybrad/lib/gcc-lib/mips-sgi-irix5.2/egcs-2.90.27/cc1plus /var/tmp/cca0040A.ii -quiet -dumpbase main.cc -Wall -version -o /var/tmp/cca0040A.s
GNU C++ version egcs-2.90.27 980315 (egcs-1.0.2 release) (mips-sgi-irix5.2) compiled by GNU C version 2.7.2.1.
/d4mutl/bybrad/mips-sgi-irix5.2/bin/as -v -o /var/tmp/cca0040A1.o /var/tmp/cca0040A.s
GNU assembler version 980320 (mips-sgi-irix5.2), using BFD version 2.8.1.0.24
/d4mutl/bybrad/lib/gcc-lib/mips-sgi-irix5.2/egcs-2.90.27/ld -call_shared -no_unresolved -_SYSTYPE_SVR4 -o main /usr/lib/crt1.o -L/d4mutl/bybrad/lib/gcc-lib/mips-sgi-irix5.2/egcs-2.90.27 -L/d4mutl/bybrad/mips-sgi-irix5.2/lib -L/d4mutl/bybrad/lib /var/tmp/cca0040A1.o -lstdc++ -lm -lgcc -lc -lgcc /usr/lib/crtn.o
%
Gives the following output:
% main
Foo: a_int=0, a_flt=0
Foo: a_int=4321, a_flt=87.65
%