public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jan Hubicka <hubicka@ucw.cz>
To: gcc-patches@gcc.gnu.org
Subject: Do not dissolve comdat groups in inliner
Date: Mon, 02 Mar 2015 20:12:00 -0000	[thread overview]
Message-ID: <20150302201200.GA846@kam.mff.cuni.cz> (raw)

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	other threads:[~2015-03-02 20:12 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150302201200.GA846@kam.mff.cuni.cz \
    --to=hubicka@ucw.cz \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).