aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2001-01-10 14:13:41 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2001-01-10 14:13:41 +0000
commit042b4c4e4d64f3eada18d9347b3c77bd6c01d002 (patch)
tree0ac0e4533452dd132c22a8e7523ad94fb622bb2d /gcc
parent780539075253658c6a5e334bb4abdf2bb3f88469 (diff)
downloadgcc-042b4c4e4d64f3eada18d9347b3c77bd6c01d002.zip
gcc-042b4c4e4d64f3eada18d9347b3c77bd6c01d002.tar.gz
gcc-042b4c4e4d64f3eada18d9347b3c77bd6c01d002.tar.bz2
call.c (build_new_method_call): Use binfo_for_vbase.
cp: * call.c (build_new_method_call): Use binfo_for_vbase. testsuite: * g++.old_deja/g++.other/vbase4.C: New test. From-SVN: r38866
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/call.c9
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/vbase4.C27
4 files changed, 41 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 173e222..e84c48a 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,7 @@
+2001-01-10 Nathan Sidwell <nathan@codesourcery.com>
+
+ * call.c (build_new_method_call): Use binfo_for_vbase.
+
2001-01-10 Joseph S. Myers <jsm28@cam.ac.uk>
* cp-tree.h (flag_cond_mismatch): Don't declare.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 0c08d18..a855963 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -4382,7 +4382,7 @@ build_new_method_call (instance, name, args, basetype_path, flags)
old ABI. */
name = constructor_p ? ctor_identifier : dtor_identifier;
}
- /* If we're call a subobject constructor or destructor for a
+ /* If we're a call to a constructor or destructor for a
subobject that uses virtual base classes, then we need to
pass down a pointer to a VTT for the subobject. */
else if ((name == base_ctor_identifier
@@ -4391,6 +4391,7 @@ build_new_method_call (instance, name, args, basetype_path, flags)
{
tree vtt;
tree sub_vtt;
+ tree basebinfo = basetype_path;
/* If the current function is a complete object constructor
or destructor, then we fetch the VTT directly.
@@ -4401,9 +4402,11 @@ build_new_method_call (instance, name, args, basetype_path, flags)
DECL_USE_VTT_PARM (current_function_decl),
DECL_VTT_PARM (current_function_decl),
vtt);
-
+ if (TREE_VIA_VIRTUAL (basebinfo))
+ basebinfo = binfo_for_vbase (basetype, current_class_type);
+ my_friendly_assert (BINFO_SUBVTT_INDEX (basebinfo), 20010110);
sub_vtt = build (PLUS_EXPR, TREE_TYPE (vtt), vtt,
- BINFO_SUBVTT_INDEX (basetype_path));
+ BINFO_SUBVTT_INDEX (basebinfo));
sub_vtt = build_indirect_ref (sub_vtt, NULL);
args = tree_cons (NULL_TREE, sub_vtt, args);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 48d6191..0dcc078 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2001-01-10 Nathan Sidwell <nathan@codesourcery.com>
+
+ * g++.old_deja/g++.other/vbase4.C: New test.
+
2001-01-08 Jonathan Larmour <jlarmour@redhat.com>
* gcc.dg/20000419-2.c: Move to "special" subdirectory.
diff --git a/gcc/testsuite/g++.old-deja/g++.other/vbase4.C b/gcc/testsuite/g++.old-deja/g++.other/vbase4.C
new file mode 100644
index 0000000..59974c3
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.other/vbase4.C
@@ -0,0 +1,27 @@
+// Build don't link:
+
+// Copyright (C) 2000 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 10 Jan 2001 <nathan@codesourcery.com>
+// Origin snyder@fnal.gov
+
+// Bug 933. Secondary vtables weren't correctly located for non-primary
+// virtual bases. Causing us to ICE.
+
+class d0_Object
+{
+public:
+virtual ~d0_Object ();
+};
+
+
+class M10 : virtual public d0_Object {};
+class M4 : virtual public M10 {};
+
+class M9
+: public M4, virtual public M10
+{
+public:
+M9 ();
+};
+
+M9::M9 () {}