Commit 64cfdfb8 by Mark Mitchell Committed by Mark Mitchell

class.c (dfs_modify_vtables): Tweak calculation of functions to override.

	* class.c (dfs_modify_vtables): Tweak calculation of functions to
	override.

From-SVN: r31886
parent ae32f34a
2000-02-10 Mark Mitchell <mark@codesourcery.com>
* class.c (dfs_modify_vtables): Tweak calculation of functions to
override.
2000-02-08 Nathan Sidwell <nathan@acm.org> 2000-02-08 Nathan Sidwell <nathan@acm.org>
* typeck.c (strip_all_pointer_quals): Use TYPE_MAIN_VARIANT, to * typeck.c (strip_all_pointer_quals): Use TYPE_MAIN_VARIANT, to
......
...@@ -3009,9 +3009,9 @@ dfs_modify_vtables (binfo, data) ...@@ -3009,9 +3009,9 @@ dfs_modify_vtables (binfo, data)
t = (tree) data; t = (tree) data;
/* If we're support RTTI then we always need a new vtable to point /* If we're supporting RTTI then we always need a new vtable to
to the RTTI information. Under the new ABI we may need a new point to the RTTI information. Under the new ABI we may need
vtable to contain vcall and vbase offsets. */ a new vtable to contain vcall and vbase offsets. */
if (flag_rtti || flag_new_abi) if (flag_rtti || flag_new_abi)
make_new_vtable (t, binfo); make_new_vtable (t, binfo);
...@@ -3031,6 +3031,7 @@ dfs_modify_vtables (binfo, data) ...@@ -3031,6 +3031,7 @@ dfs_modify_vtables (binfo, data)
tree overrider; tree overrider;
tree vindex; tree vindex;
tree delta; tree delta;
int i;
/* Find the function which originally caused this vtable /* Find the function which originally caused this vtable
entry to be present. */ entry to be present. */
...@@ -3039,9 +3040,12 @@ dfs_modify_vtables (binfo, data) ...@@ -3039,9 +3040,12 @@ dfs_modify_vtables (binfo, data)
b = dfs_walk (binfo, dfs_find_base, NULL, DECL_VIRTUAL_CONTEXT (fn)); b = dfs_walk (binfo, dfs_find_base, NULL, DECL_VIRTUAL_CONTEXT (fn));
fn = skip_rtti_stuff (TYPE_BINFO (BINFO_TYPE (b)), fn = skip_rtti_stuff (TYPE_BINFO (BINFO_TYPE (b)),
BINFO_TYPE (b), BINFO_TYPE (b),
NULL); &i);
while (!tree_int_cst_equal (DECL_VINDEX (BV_FN (fn)), vindex)) while (i < TREE_INT_CST_LOW (vindex))
fn = TREE_CHAIN (fn); {
fn = TREE_CHAIN (fn);
++i;
}
fn = BV_FN (fn); fn = BV_FN (fn);
/* Handle the case of a virtual function defined in BINFO /* Handle the case of a virtual function defined in BINFO
......
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 8 Feb 2000 <nathan@acm.org>
// vtable construction reorganisation broke this
// execution test
#include <stdio.h>
static int fail = 0;
void bad (char const *name)
{
printf ("Bad %s\n", name);
fail = 1;
}
void ok (char const *name)
{
printf ("Ok %s\n", name);
}
struct Core
{
virtual ~Core ();
virtual void Wibble () {bad (__PRETTY_FUNCTION__);}
virtual void Wobble () {bad (__PRETTY_FUNCTION__);}
virtual void Bogus () {bad (__PRETTY_FUNCTION__);}
};
struct Side
{
virtual ~Side ();
virtual void Arfle () {bad (__PRETTY_FUNCTION__);}
virtual void Barfle () {bad (__PRETTY_FUNCTION__);}
virtual void Gloop () {bad (__PRETTY_FUNCTION__);}
virtual void Glorp () {bad (__PRETTY_FUNCTION__);}
virtual void Glump () {bad (__PRETTY_FUNCTION__);}
virtual void Bogus () {bad (__PRETTY_FUNCTION__);}
};
struct Base : Core
{
virtual ~Base ();
virtual void Bink () {bad (__PRETTY_FUNCTION__);}
virtual void Bonk () {bad (__PRETTY_FUNCTION__);}
virtual void Bogus () {bad (__PRETTY_FUNCTION__);}
};
struct Multi : Base, Side
{
virtual ~Multi ();
virtual void Stomped () {ok (__PRETTY_FUNCTION__);}
virtual void Bunk () {bad (__PRETTY_FUNCTION__);}
virtual void Bogus () {bad (__PRETTY_FUNCTION__);}
};
struct Trail : Multi
{
virtual ~Trail ();
};
Core::~Core () {}
Side::~Side () {}
Base::~Base () {}
Multi::~Multi () {}
Trail::~Trail () {}
void foo (Multi *ptr)
{
ptr->Stomped ();
}
int main ()
{
Multi m;
Trail t;
foo (&m);
foo (&t);
return fail != 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