Commit 73ea87d7 by Nathan Sidwell Committed by Nathan Sidwell

Fix ctor vtable vcall offsets.

cp:
	Fix ctor vtable vcall offsets.
	* class.c (struct vtbl_init_data_s): Add rtti_binfo member.
	(build_rtt_vtbl_entries): Lose RTTI_BINFO parameter.
	(get_matching_base): Remove.
	(get_original_base): New function.
	(build_vtbl_initializer): Initialize vid.rtti_binfo.
	Use a virtual thunk for a ctor vtable with an index
	(add_vcall_offset_vtbl_entries_1): Check if binfo has lost a
	primary base within a constructor vtable. Only set
	BV_VCALL_INDEX when not a constructor vtable. Adjust vcall offset
	when primary base has been lost.
	* cp-tree.h (BINFO_VIRTUALS): Remove ambiguity from comment.
testsuite:
	* g++.old-deja/g++.abi/vtable3.h: Check vcall offsets too.

From-SVN: r40090
parent faa7e814
2001-02-27 Nathan Sidwell <nathan@codesourcery.com>
Fix ctor vtable vcall offsets.
* class.c (struct vtbl_init_data_s): Add rtti_binfo member.
(build_rtt_vtbl_entries): Lose RTTI_BINFO parameter.
(get_matching_base): Remove.
(get_original_base): New function.
(build_vtbl_initializer): Initialize vid.rtti_binfo.
Use a virtual thunk for a ctor vtable with an index
(add_vcall_offset_vtbl_entries_1): Check if binfo has lost a
primary base within a constructor vtable. Only set
BV_VCALL_INDEX when not a constructor vtable. Adjust vcall offset
when primary base has been lost.
* cp-tree.h (BINFO_VIRTUALS): Remove ambiguity from comment.
2001-02-26 Jeffrey Oldham <oldham@codesourcery.com>
* call.c (joust): Ensure more_specialized()'s argument length
......
......@@ -136,7 +136,7 @@ Boston, MA 02111-1307, USA. */
does not have a BV_FN; it is just an offset.
The BV_OVERRIDING_BASE is the binfo for the final overrider for
this function. (This binfo's BINFO_TYPE will always be the same
this function. (That binfo's BINFO_TYPE will always be the same
as the DECL_CLASS_CONTEXT for the function.)
BINFO_VTABLE
......
2001-02-27 Nathan Sidwell <nathan@codesourcery.com>
* g++.old-deja/g++.abi/vtable3.h: Check vcall offsets too.
2001-02-26 Will Cohen <wcohen@redhat.com>
* gcc.c-torture/execute/ieee/20010226-1.c: New test.
......
......@@ -7,11 +7,8 @@
#include <typeinfo>
#include <stdio.h>
// XXX. vcall offsets are still broken, remove this define to re-enable
// testing when fixed.
#define NO_VCALL_TEST
int fail;
struct A;
template <typename BASE, typename DERIVED>
int Test (DERIVED *d, int expect)
......@@ -19,6 +16,7 @@ int Test (DERIVED *d, int expect)
BASE *b = static_cast <BASE *> (d);
void *full_b = dynamic_cast <void *> (b);
void *full_d = dynamic_cast <void *> (d);
A *ap = static_cast <A *> (b);
if (full_b != full_d)
{
......@@ -37,8 +35,8 @@ int Test (DERIVED *d, int expect)
typeid (BASE).name (), typeid (DERIVED).name ());
return 1;
}
#ifndef NO_VCALL_TEST
b->Baz (static_cast <void *> (b));
b->Baz (static_cast <void *> (ap));
int res = b->Foo (static_cast <void *> (d));
......@@ -49,7 +47,7 @@ int Test (DERIVED *d, int expect)
typeid (BASE).name (), res, expect);
return 1;
}
#endif
return 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment