This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ PATCH: Change vcall offset handling for destructors
- To: gcc-patches at gcc dot gnu dot org
- Subject: C++ PATCH: Change vcall offset handling for destructors
- From: Mark Mitchell <mark at codesourcery dot com>
- Date: Sun, 18 Feb 2001 12:44:08 -0800
- Organization: CodeSourcery, LLC
Jason Merrill pointed out that the ABI document was unclear as to how
many vcall offsets should be allocated for a destructor, since
destructors get two virtual function table entries.
He suggested, and there seems to be no disagreement, that we need only
one such entry. This change makes G++ conform to the now
better-specified ABI. (We are also in the process of updating the ABI
document.)
Tested on i686-pc-linux-gnu, applied on the mainline and on the branch.
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
2001-02-18 Mark Mitchell <mark@codesourcery.com>
* class.c (add_vcall_offset_vtbl_entries_1): Only add one entry
for a destructor.
Index: cp/class.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/class.c,v
retrieving revision 1.358.2.2
diff -c -p -r1.358.2.2 class.c
*** class.c 2001/02/14 10:50:50 1.358.2.2
--- class.c 2001/02/18 20:28:07
*************** add_vcall_offset_vtbl_entries_1 (binfo,
*** 7689,7695 ****
tree derived_entry;
derived_entry = VARRAY_TREE (vid->fns, i);
! if (same_signature_p (BV_FN (derived_entry), fn))
{
BV_VCALL_INDEX (derived_virtuals)
= BV_VCALL_INDEX (derived_entry);
--- 7689,7699 ----
tree derived_entry;
derived_entry = VARRAY_TREE (vid->fns, i);
! if (same_signature_p (BV_FN (derived_entry), fn)
! /* We only use one vcall offset for virtual destructors,
! even though there are two virtual table entries. */
! || (DECL_DESTRUCTOR_P (BV_FN (derived_entry))
! && DECL_DESTRUCTOR_P (fn)))
{
BV_VCALL_INDEX (derived_virtuals)
= BV_VCALL_INDEX (derived_entry);