Fix bug in vtable initialization

From-SVN: r177731
This commit is contained in:
David Li 2011-08-13 05:13:57 +00:00 committed by Xinliang David Li
parent b203901cda
commit 8434c30579
4 changed files with 40 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2011-08-12 David Li <davidxl@google.com>
* cp/class.c (update_vtable_entry_for_fn): Set
LOST_PRIMARY bit properly.
2011-08-12 Richard Henderson <rth@redhat.com>
PR rtl-opt/49994

View File

@ -2294,8 +2294,7 @@ update_vtable_entry_for_fn (tree t, tree binfo, tree fn, tree* virtuals,
else
BV_VCALL_INDEX (*virtuals) = NULL_TREE;
if (lost)
BV_LOST_PRIMARY (*virtuals) = true;
BV_LOST_PRIMARY (*virtuals) = lost;
}
/* Called from modify_all_vtables via dfs_walk. */

View File

@ -1,3 +1,7 @@
2011-08-12 David Li <davidxl@google.com>
* g++.dg/abi/vbase15.C: New test.
2011-08-12 Jason Merrill <jason@redhat.com>
PR c++/50034

View File

@ -0,0 +1,30 @@
// { dg-do run }
struct Spec
{
virtual int id () const = 0;
};
class D1_1_Spec : public virtual Spec { };
class D1_2_Spec : public virtual Spec { };
class D1_3_Spec : public virtual Spec { };
class D2_1_Spec : public D1_1_Spec, public D1_2_Spec { };
class D2_Spec : public virtual D2_1_Spec, public virtual D1_3_Spec { };
struct D3_Spec : public D2_Spec
{
virtual int id () const { return 3; }
};
__attribute__((noinline)) void foo(D3_Spec* spec)
{
spec->id();
}
int main()
{
D3_Spec spec;
foo(&spec);
return 0;
}