[C++ PATCH]: fix bug 143
Nathan Sidwell
nathan@codesourcery.com
Tue Jun 20 09:16:00 GMT 2000
Hi,
I've installed the attached patch and testcase which fixes bug 143.
When fishing out the FIELD_DECL of a vbase pointer, we'd forget that it
might be in a base at non-zero offset. Hence out type_info structures
could be hosed.
Approved by Mark, built & tested on i686-pc-linux-gnu
nathan
--
Dr Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org
2000-06-20 Nathan Sidwell <nathan@codesourcery.com>
* rtti.c (get_base_offset): Cope when vbase field is in a base.
Index: cp/rtti.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/rtti.c,v
retrieving revision 1.95
diff -c -3 -p -r1.95 rtti.c
*** rtti.c 2000/06/14 05:30:05 1.95
--- rtti.c 2000/06/20 12:18:05
*************** get_base_offset (binfo, parent)
*** 549,558 ****
else if (! vbase_offsets_in_vtable_p ())
{
const char *name;
FORMAT_VBASE_NAME (name, BINFO_TYPE (binfo));
! return byte_position (lookup_field (parent, get_identifier (name),
! 0, 0));
}
else
/* Under the new ABI, we store the vtable offset at which
--- 549,573 ----
else if (! vbase_offsets_in_vtable_p ())
{
const char *name;
+ tree result;
+ tree field;
FORMAT_VBASE_NAME (name, BINFO_TYPE (binfo));
! field = lookup_field (parent, get_identifier (name), 0, 0);
! result = byte_position (field);
!
! if (DECL_CONTEXT (field) != parent)
! {
! /* The vbase pointer might be in a non-virtual base of PARENT.
! * Adjust for the offset of that base in PARENT. */
! tree path;
!
! get_base_distance (DECL_CONTEXT (field), parent, -1, &path);
! result = build (PLUS_EXPR, TREE_TYPE (result),
! result, BINFO_OFFSET (path));
! result = fold (result);
! }
! return result;
}
else
/* Under the new ABI, we store the vtable offset at which
More information about the Gcc-patches
mailing list