cooper@UUNET.UU.NET (Clark Cooper) (10/24/88)
System: G++ 1.27.0 Hardware: Sun 3/50 OS: SunOS 3.5 Configuration: tm-sun3.h Symptoms: The constructor of a derived class calls itself instead of the constructor of its base class. Script: ================================== Script started on Mon Oct 24 10:50:02 1988 gecrux% cat junk.cc class B { unsigned x; public: B () { x = 1;} ~B () { if (--x > 0) { this = 0;}} }; class D : public B { public: D(); ~D(); private: int y; }; D::D () { y = 0; } gecrux% g++ -v -O -S junk.cc g++ version 1.27.0 /usr/local/lib/gcc-cpp+ -v -undef -D__GNU__ -D__GNUG__ -Dmc68000 -Dsun -Dunix -D__OPTIMIZE__ junk.cc /tmp/cca02607.cpp GNU CPP version 1.27.0 /usr/local/lib/gcc-c++ /tmp/cca02607.cpp -quiet -dumpbase junk.cc -opt -version -o junk.s GNU C++ version 1.27.0 (68k, MIT syntax) compiled by GNU C version 1.28. gecrux% cat junk.s #NO_APP .text .even _B_PSB: link a6,#0 movel a6@(8),a0 tstl a0 jne L2 pea 4:w jbsr ___builtin_new movel d0,a0 L2: moveq #1,d1 movel d1,a0@ movel a0,d0 unlk a6 rts .even __$_B: link a6,#0 movel a6@(8),a0 tstl a0 jeq L6 subql #1,a0@ L6: unlk a6 rts .even .globl _D_PSD _D_PSD: link a6,#0 movel a6@(8),a0 tstl a0 jne L8 pea 8:w jbsr ___builtin_new movel d0,a0 addqw #4,sp L8: movel a0,sp@- jbsr _D_PSD ;;; <--- This should be _B_PSB movel d0,a0 clrl a0@(4) unlk a6 rts gecrux% ^D script done on Mon Oct 24 10:50:40 1988 ======================================== Clark Cooper cooper@gecrux.steinmetz.ge.com, coopercc@crd.ge.com, coopercc@ge-crd.arpa, ...!uunet!steinmetz!cooper
cooper@gecrux.steinmetz.ge.com (Clark Cooper) (10/24/88)
System: G++ 1.27.0 Hardware: Sun 3/50 OS: SunOS 3.5 Configuration: tm-sun3.h Symptoms: The constructor of a derived class calls itself instead of the constructor of its base class. Script: ================================== Script started on Mon Oct 24 10:50:02 1988 gecrux% cat junk.cc class B { unsigned x; public: B () { x = 1;} ~B () { if (--x > 0) { this = 0;}} }; class D : public B { public: D(); ~D(); private: int y; }; D::D () { y = 0; } gecrux% g++ -v -O -S junk.cc g++ version 1.27.0 /usr/local/lib/gcc-cpp+ -v -undef -D__GNU__ -D__GNUG__ -Dmc68000 -Dsun -Dunix -D__OPTIMIZE__ junk.cc /tmp/cca02607.cpp GNU CPP version 1.27.0 /usr/local/lib/gcc-c++ /tmp/cca02607.cpp -quiet -dumpbase junk.cc -opt -version -o junk.s GNU C++ version 1.27.0 (68k, MIT syntax) compiled by GNU C version 1.28. gecrux% cat junk.s #NO_APP .text .even _B_PSB: link a6,#0 movel a6@(8),a0 tstl a0 jne L2 pea 4:w jbsr ___builtin_new movel d0,a0 L2: moveq #1,d1 movel d1,a0@ movel a0,d0 unlk a6 rts .even __$_B: link a6,#0 movel a6@(8),a0 tstl a0 jeq L6 subql #1,a0@ L6: unlk a6 rts .even .globl _D_PSD _D_PSD: link a6,#0 movel a6@(8),a0 tstl a0 jne L8 pea 8:w jbsr ___builtin_new movel d0,a0 addqw #4,sp L8: movel a0,sp@- jbsr _D_PSD ;;; <--- This should be _B_PSB movel d0,a0 clrl a0@(4) unlk a6 rts gecrux% ^D script done on Mon Oct 24 10:50:40 1988 --- -- Clark Cooper cooper@gecrux.steinmetz.ge.com, coopercc@crd.ge.com, coopercc@ge-crd.arpa, ...!uunet!steinmetz!cooper