Hi,
in the testcase bellow the comdat local function is inlined and inliner 
mistakely
dissolve the whole comdat group.  This is wrong and leads to ICE here, but it 
also
may lead to undefined symbols due to groups being wrong.

Bootstrapped/regtested x86_64-linux, comitted.

        PR ipa/64988
        * ipa-inline-transform.c (clone_inlined_nodes): Do not dissolve
        comdat groups.
        * g++.dg/torture/pr64988.C: New testcase.
Index: ipa-inline-transform.c
===================================================================
--- ipa-inline-transform.c      (revision 221122)
+++ ipa-inline-transform.c      (working copy)
@@ -213,7 +213,7 @@ clone_inlined_nodes (struct cgraph_edge
             For now we keep the ohter functions in the group in program until
             cgraph_remove_unreachable_functions gets rid of them.  */
          gcc_assert (!e->callee->global.inlined_to);
-         e->callee->dissolve_same_comdat_group_list ();
+         e->callee->remove_from_same_comdat_group ();
          if (e->callee->definition
              && inline_account_function_p (e->callee))
            {
@@ -243,7 +243,7 @@ clone_inlined_nodes (struct cgraph_edge
        }
     }
   else
-    e->callee->dissolve_same_comdat_group_list ();
+    e->callee->remove_from_same_comdat_group ();
 
   e->callee->global.inlined_to = inlining_into;
 
Index: testsuite/g++.dg/torture/pr64988.C
===================================================================
--- testsuite/g++.dg/torture/pr64988.C  (revision 0)
+++ testsuite/g++.dg/torture/pr64988.C  (revision 0)
@@ -0,0 +1,12 @@
+// { dg-do compile }
+// { dg-options "-O -fdeclone-ctor-dtor" }
+struct A {
+  virtual ~ A ();
+};
+
+struct B : virtual A {};
+struct C : virtual A {};
+
+struct D : B, C {};
+
+D d;

Reply via email to