From d862b3439d1996c99a532476a181b6f3c0c69257 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Fri, 7 Nov 2014 14:37:41 +0100 Subject: [PATCH] re PR ipa/63580 (ICE : error: invalid argument to gimple call) PR ipa/63580 * cgraphunit.c (cgraph_node::create_wrapper): TREE_ADDRESSABLE is set to false for a newly created thunk. * g++.dg/ipa/pr63580.C: New test. From-SVN: r217222 --- gcc/ChangeLog | 6 ++++++ gcc/cgraphunit.c | 8 ++++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/ipa/pr63580.C | 26 ++++++++++++++++++++++++++ 4 files changed, 45 insertions(+) create mode 100644 gcc/testsuite/g++.dg/ipa/pr63580.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6e721a68b20..c418283e84a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2014-11-07 Martin Liska + + PR ipa/63580 + * cgraphunit.c (cgraph_node::create_wrapper): + TREE_ADDRESSABLE is set to false for a newly created thunk. + 2014-11-07 Martin Liska PR ipa/63747 diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index 75d414024a7..25af2347f42 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -2369,6 +2369,14 @@ cgraph_node::create_wrapper (cgraph_node *target) cgraph_edge *e = create_edge (target, NULL, 0, CGRAPH_FREQ_BASE); + tree arguments = DECL_ARGUMENTS (decl); + + while (arguments) + { + TREE_ADDRESSABLE (arguments) = false; + arguments = TREE_CHAIN (arguments); + } + expand_thunk (false, true); e->call_stmt_cannot_inline_p = true; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 036d59d3013..6bd9aed5ec2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-11-07 Martin Liska + + PR ipa/63580 + * g++.dg/ipa/pr63580.C: New test. + 2014-11-07 Martin Liska PR ipa/63747 diff --git a/gcc/testsuite/g++.dg/ipa/pr63580.C b/gcc/testsuite/g++.dg/ipa/pr63580.C new file mode 100644 index 00000000000..904195a70be --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/pr63580.C @@ -0,0 +1,26 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fdump-ipa-icf" } */ + +struct A +{ +}; +template A operator%(L, R); +template +void make_tuple (A0 &, A1, A2, A3); +A +bar (int p1, char p2, int p3, double p4) +{ + A a; + make_tuple (p1, p2, p3, p4); + return "int; char; string; double; " % a; +} +A +foo (int p1, char p2, int p3, double p4) +{ + A b; + make_tuple (p1, p2, p3, p4); + return "int; char; string; double; " % b; +} + +/* { dg-final { scan-ipa-dump "Equal symbols: 1" "icf" } } */ +/* { dg-final { cleanup-ipa-dump "icf" } } */ -- 2.30.2