This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

C++ PATCH: Change vcall offset handling for destructors



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);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]