diff options
author | Martin Jambor <mjambor@suse.cz> | 2014-09-10 13:34:09 +0200 |
---|---|---|
committer | Martin Jambor <jamborm@gcc.gnu.org> | 2014-09-10 13:34:09 +0200 |
commit | bec6320858ac191ce070cb789fc55792a73084da (patch) | |
tree | d7ee14246bd51291d717e5677748ab95847ddc12 /gcc/cgraphclones.c | |
parent | f3955ea361ad6652af0cd456be138ec6ba5c7d68 (diff) | |
download | gcc-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
Diffstat (limited to 'gcc/cgraphclones.c')
-rw-r--r-- | gcc/cgraphclones.c | 21 |
1 files changed, 21 insertions, 0 deletions
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; |