aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2010-09-23 12:39:26 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2010-09-23 12:39:26 +0000
commit3d11339491ec3085638198715c880e7d19e1ae6b (patch)
tree2f5df5c8bd6aecb5ecc5b109b2f2938e21a29f69 /gcc
parentbef6486a5a2fdb1008e582d5ac048dd243e91142 (diff)
downloadgcc-3d11339491ec3085638198715c880e7d19e1ae6b.zip
gcc-3d11339491ec3085638198715c880e7d19e1ae6b.tar.gz
gcc-3d11339491ec3085638198715c880e7d19e1ae6b.tar.bz2
re PR middle-end/45565 (ICE: in execute_todo, at passes.c:1276 with -fno-toplevel-reorder -fno-inline -fipa-cp-clone -fkeep-inline-functions)
2010-09-23 Richard Guenther <rguenther@suse.de> PR tree-optimization/45565 * cgraphunit.c (cgraph_redirect_edge_call_stmt_to_callee): Make sure to adjust the fndecl before replacing the stmt. * g++.dg/ipa/pr45565.C: New testcase. From-SVN: r164561
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/cgraphunit.c10
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/ipa/pr45565.C29
4 files changed, 46 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4b5294c..425e14f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2010-09-23 Richard Guenther <rguenther@suse.de>
+ PR tree-optimization/45565
+ * cgraphunit.c (cgraph_redirect_edge_call_stmt_to_callee):
+ Make sure to adjust the fndecl before replacing the stmt.
+
+2010-09-23 Richard Guenther <rguenther@suse.de>
+
PR middle-end/45750
* gimplify.c (gimplify_expr): Properly pass on GS_ERROR when
gimplifying MEM_REF.
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index e390ec6..b51a71c 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -2159,6 +2159,7 @@ cgraph_redirect_edge_call_stmt_to_callee (struct cgraph_edge *e)
new_stmt
= gimple_call_copy_skip_args (e->call_stmt,
e->callee->clone.combined_args_to_skip);
+ gimple_call_set_fndecl (new_stmt, e->callee->decl);
if (gimple_vdef (new_stmt)
&& TREE_CODE (gimple_vdef (new_stmt)) == SSA_NAME)
@@ -2168,10 +2169,11 @@ cgraph_redirect_edge_call_stmt_to_callee (struct cgraph_edge *e)
gsi_replace (&gsi, new_stmt, true);
}
else
- new_stmt = e->call_stmt;
-
- gimple_call_set_fndecl (new_stmt, e->callee->decl);
- update_stmt (new_stmt);
+ {
+ new_stmt = e->call_stmt;
+ gimple_call_set_fndecl (new_stmt, e->callee->decl);
+ update_stmt (new_stmt);
+ }
cgraph_set_call_stmt_including_clones (e->caller, e->call_stmt, new_stmt);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index da30c4b..db8da87 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2010-09-23 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/45565
+ * g++.dg/ipa/pr45565.C: New testcase.
+
2010-09-23 Mikael Morin <mikael@gcc.gnu.org>
PR fortran/45745
diff --git a/gcc/testsuite/g++.dg/ipa/pr45565.C b/gcc/testsuite/g++.dg/ipa/pr45565.C
new file mode 100644
index 0000000..c04de12
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ipa/pr45565.C
@@ -0,0 +1,29 @@
+// { dg-do compile }
+// { dg-options "-O -fno-toplevel-reorder -fno-inline -fipa-cp -fipa-cp-clone -fkeep-inline-functions" }
+
+template < typename Derived > struct AnyMatrixBase
+{
+};
+
+struct Matrix Random ();
+
+struct Matrix:AnyMatrixBase < Matrix >
+{
+ void bar ()
+ {
+ throw;
+ }
+ void foo (Matrix other)
+ {
+ bar ();
+ Matrix (AnyMatrixBase < Matrix > (Random ()));
+ }
+ template
+ < typename OtherDerived > Matrix (AnyMatrixBase < OtherDerived > other)
+ {
+ foo (other);
+ }
+};
+
+Matrix x (Random ());
+