Article View: gnu.g++.help
Article #242Problem with virtual destructors
From: Lee Cooprider
Date: Sun, 13 Sep 1992 23:08
Date: Sun, 13 Sep 1992 23:08
45 lines
1502 bytes
1502 bytes
I am using C++ from gcc version 2.2.1 on a Sparc platform.
My problem is with virtual destructors. Whenever my real destructor is
called, the program abort()'s after executing the destructor successfully.
This program illustrates the problem:
class aaa {
public:
virtual ~aaa() = 0;};
class bbb : public aaa {
public:
bbb();
~bbb();};
bbb::bbb() {}
bbb::~bbb() {}
The assembler for ~bbb() has an unconditional abort() call at the end. Is
this the correct code? Is there an additional requirement on virtual
destructors? Is it not legal for a destructor to be pure-virtual?
This is the assembler code for the ~bbb() routine above:
__$_3bbb:
!#PROLOGUE# 0
save %sp,-112,%sp
!#PROLOGUE# 1
mov %i0,%l0
st %i1,[%fp+72]
sethi %hi(__vt$bbb),%o1
or %o1,%lo(__vt$bbb),%o0
st %o0,[%l0]
L4:
mov %l0,%o0
ld [%fp+72],%o1
call _abort,0
nop
L3:
ret
restore
--
Lee W. Cooprider PP-ASEL/IA
Lee_Cooprider@vos.stratus.com Skylane N2908F "Wiley"
Technical Details
Message-ID:
<6334@transfer.stratus.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!bu.edu!transfer!bluefuzz.sw.stratus.com!leeShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!bu.edu!transfer!bluefuzz.sw.stratus.com!lee From: lee@bluefuzz.sw.stratus.com (Lee Cooprider) Newsgroups: gnu.g++.help Subject: Problem with virtual destructors Message-ID: <6334@transfer.stratus.com> Date: 13 Sep 92 23:08:14 GMT Sender: usenet@transfer.stratus.com Distribution: gnu Organization: Stratus Computer, Software Engineering Lines: 45