aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Jambor <mjambor@suse.cz>2014-09-10 13:34:09 +0200
committerMartin Jambor <jamborm@gcc.gnu.org>2014-09-10 13:34:09 +0200
commitbec6320858ac191ce070cb789fc55792a73084da (patch)
treed7ee14246bd51291d717e5677748ab95847ddc12
parentf3955ea361ad6652af0cd456be138ec6ba5c7d68 (diff)
downloadgcc-bec6320858ac191ce070cb789fc55792a73084da.zip
gcc-bec6320858ac191ce070cb789fc55792a73084da.tar.gz
gcc-bec6320858ac191ce070cb789fc55792a73084da.tar.bz2
re PR middle-end/61654 (ICE in release_function_body, at cgraph.c:1699)
2014-09-10 Martin Jambor <mjambor@suse.cz> PR ipa/61654 * cgraphclones.c (duplicate_thunk_for_node): Copy arguments of the new decl properly. Analyze the new thunk if it is expanded. gcc/testsuite/ * g++.dg/ipa/pr61654.C: New test. From-SVN: r215122
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/cgraphclones.c21
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/ipa/pr61654.C40
4 files changed, 72 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index aab2439..3c91906 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2014-09-10 Martin Jambor <mjambor@suse.cz>
+
+ PR ipa/61654
+ * cgraphclones.c (duplicate_thunk_for_node): Copy arguments of the
+ new decl properly. Analyze the new thunk if it is expanded.
+
2014-09-10 Andreas Schwab <schwab@suse.de>
* coretypes.h (struct _dont_use_rtx_insn_here_, rtx_insn)
diff --git a/gcc/cgraphclones.c b/gcc/cgraphclones.c
index eb04418..2a17de5 100644
--- a/gcc/cgraphclones.c
+++ b/gcc/cgraphclones.c
@@ -334,6 +334,22 @@ duplicate_thunk_for_node (cgraph_node *thunk, cgraph_node *node)
node->clone.args_to_skip,
false);
}
+
+ tree *link = &DECL_ARGUMENTS (new_decl);
+ int i = 0;
+ for (tree pd = DECL_ARGUMENTS (thunk->decl); pd; pd = DECL_CHAIN (pd), i++)
+ {
+ if (!node->clone.args_to_skip
+ || !bitmap_bit_p (node->clone.args_to_skip, i))
+ {
+ tree nd = copy_node (pd);
+ DECL_CONTEXT (nd) = new_decl;
+ *link = nd;
+ link = &DECL_CHAIN (nd);
+ }
+ }
+ *link = NULL_TREE;
+
gcc_checking_assert (!DECL_STRUCT_FUNCTION (new_decl));
gcc_checking_assert (!DECL_INITIAL (new_decl));
gcc_checking_assert (!DECL_RESULT (new_decl));
@@ -357,6 +373,11 @@ duplicate_thunk_for_node (cgraph_node *thunk, cgraph_node *node)
symtab->call_edge_duplication_hooks (thunk->callees, e);
if (!new_thunk->expand_thunk (false, false))
new_thunk->analyzed = true;
+ else
+ {
+ new_thunk->thunk.thunk_p = false;
+ new_thunk->analyze ();
+ }
symtab->call_cgraph_duplication_hooks (thunk, new_thunk);
return new_thunk;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index b6b96fd..e4fc660 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2014-09-10 Martin Jambor <mjambor@suse.cz>
+
+ PR ipa/61654
+ * g++.dg/ipa/pr61654.C: New test.
+
2014-09-10 Jakub Jelinek <jakub@redhat.com>
* c-c++-common/ubsan/attrib-3.c: New test.
diff --git a/gcc/testsuite/g++.dg/ipa/pr61654.C b/gcc/testsuite/g++.dg/ipa/pr61654.C
new file mode 100644
index 0000000..d07e458
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ipa/pr61654.C
@@ -0,0 +1,40 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+/* The bug only presented itself on a 32 bit i386 but in theory it might also
+ pop up elsewhere and we do not want to put -m32 options to testcase
+ options. */
+
+struct A
+{
+ virtual int a (int, int = 0) = 0;
+ void b ();
+ void c ();
+ int d;
+};
+
+struct B : virtual A
+{
+ int a (int, int);
+ int e;
+};
+
+int f;
+
+void
+A::b ()
+{
+ a (0);
+}
+
+void
+A::c ()
+{
+ a (f);
+}
+
+int
+B::a (int, int)
+{
+ return e;
+}