cp:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 31 Jul 2001 08:49:00 +0000 (08:49 +0000)
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 31 Jul 2001 08:49:00 +0000 (08:49 +0000)
* class.c (dfs_ctor_vtable_bases_queue_p): Always walk into
the shared virtual base, so preserving inheritance graph order.
testsuite:
* g++.dg/abi/vbase8-22.C: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@44506 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/class.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/abi/vbase8-22.C [new file with mode: 0644]

index 1f96e87..b1f52f3 100644 (file)
@@ -1,3 +1,8 @@
+2001-07-31  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * class.c (dfs_ctor_vtable_bases_queue_p): Always walk into
+       the shared virtual base, so preserving inheritance graph order.
+
 2001-07-30  Andreas Jaeger  <aj@suse.de>
 
         * decl2.c: Remove unused var global_temp_name_counter.
index 7f2ea60..f4aae8e 100644 (file)
@@ -7195,24 +7195,19 @@ dfs_build_secondary_vptr_vtt_inits (binfo, data)
 }
 
 /* dfs_walk_real predicate for building vtables. DATA is a TREE_LIST,
-   TREE_UNSIGNED indicates that a constructor vtable is being built.
-   TREE_USED indicates whether marked or unmarked bases should be walked.
-   TREE_PURPOSE is the TREE_TYPE that dominates the hierarchy.  */
+   VTT_MARKED_BINFO_P indicates whether marked or unmarked bases
+   should be walked.  TREE_PURPOSE is the TREE_TYPE that dominates the
+   hierarchy.  */
 
 static tree
 dfs_ctor_vtable_bases_queue_p (binfo, data)
      tree binfo;
      void *data;
 {
-  if (TREE_VIA_VIRTUAL (binfo) && !BINFO_PRIMARY_P (binfo))
-    {
-      tree type = TREE_PURPOSE ((tree) data);
+  if (TREE_VIA_VIRTUAL (binfo))
+     /* Get the shared version.  */
+    binfo = binfo_for_vbase (BINFO_TYPE (binfo), TREE_PURPOSE ((tree) data));
 
-      /* This is a non-primary virtual base, get the shared version.  */
-      binfo = binfo_for_vbase (BINFO_TYPE (binfo), type);
-      if (VTT_TOP_LEVEL_P ((tree) data) && BINFO_PRIMARY_P (binfo))
-        return NULL_TREE;
-    }
   if (!BINFO_MARKED (binfo) == VTT_MARKED_BINFO_P ((tree) data))
     return NULL_TREE;
   return binfo;
index 8a88b5e..8c8670e 100644 (file)
@@ -1,3 +1,7 @@
+2001-07-31  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * g++.dg/abi/vbase8-22.C: New test.
+
 2001-07-31  Neil Booth  <neil@cat.daikokuya.demon.co.uk>
 
        * gcc.dg/cpp/macro8.c: New test.
diff --git a/gcc/testsuite/g++.dg/abi/vbase8-22.C b/gcc/testsuite/g++.dg/abi/vbase8-22.C
new file mode 100644 (file)
index 0000000..4edb2b4
--- /dev/null
@@ -0,0 +1,80 @@
+// { dg-options -w }
+// { dg-do run }
+
+// Copyright (C) 2001 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 27 Jul 2001 <nathan@codesourcery.com>
+
+// Origin stefan@space.twc.de
+// Bug 3145 case 22. Horribly complicated class hierarchy
+
+class C0
+{};
+class C1
+ :  public C0
+{};
+class C2
+ :  public C1
+ ,  virtual public C0
+{};
+class C3
+ :  virtual public C0
+ ,  virtual public C2
+ ,  virtual public C1
+{};
+class C4
+ :  virtual public C2
+ ,  public C1
+ ,  virtual public C3
+ ,  public C0
+{};
+class C5
+ :  virtual public C0
+ ,  virtual public C4
+ ,  public C1
+ ,  virtual public C2
+ ,  virtual public C3
+{};
+class C6
+ :  public C0
+ ,  virtual public C1
+ ,  public C5
+ ,  public C2
+ ,  virtual public C3
+ ,  virtual public C4
+{};
+class C7
+ :  virtual public C1
+ ,  public C5
+ ,  virtual public C6
+ ,  virtual public C4
+ ,  virtual public C3
+ ,  virtual public C0
+{};
+class C8
+ :  virtual public C6
+ ,  virtual public C1
+ ,  virtual public C2
+ ,  public C3
+ ,  virtual public C4
+{};
+class C9
+ :  public C4
+ ,  virtual public C2
+ ,  virtual public C8
+ ,  public C3
+ ,  public C1
+ ,  public C6
+ ,  public C5
+{};
+main() {
+  C0 c0;
+  C1 c1;
+  C2 c2;
+  C3 c3;
+  C4 c4;
+  C5 c5;
+  C6 c6;
+  C7 c7;
+  C8 c8;
+  C9 c9;
+}