2013-05-21 Richard Biener <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 21 May 2013 11:56:57 +0000 (11:56 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 21 May 2013 11:56:57 +0000 (11:56 +0000)
PR tree-optimization/57330
* cgraph.c (cgraph_redirect_edge_call_stmt_to_callee): Properly
preserve the call stmts fntype.

* gcc.dg/torture/pr57330.c: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@199139 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/cgraph.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr57330.c [new file with mode: 0644]

index 0a7c1e7..bab6db4 100644 (file)
@@ -1,5 +1,11 @@
 2013-05-21  Richard Biener  <rguenther@suse.de>
 
+       PR tree-optimization/57330
+       * cgraph.c (cgraph_redirect_edge_call_stmt_to_callee): Properly
+       preserve the call stmts fntype.
+
+2013-05-21  Richard Biener  <rguenther@suse.de>
+
        PR tree-optimization/57303
        * tree-ssa-sink.c (statement_sink_location): Improve killing
        stmt detection and properly handle self-assignments.
index 899f65c..2a2973b 100644 (file)
@@ -1068,6 +1068,7 @@ cgraph_redirect_edge_call_stmt_to_callee (struct cgraph_edge *e)
        = gimple_call_copy_skip_args (e->call_stmt,
                                      e->callee->clone.combined_args_to_skip);
       gimple_call_set_fndecl (new_stmt, e->callee->symbol.decl);
+      gimple_call_set_fntype (new_stmt, gimple_call_fntype (e->call_stmt));
 
       if (gimple_vdef (new_stmt)
          && TREE_CODE (gimple_vdef (new_stmt)) == SSA_NAME)
index 0783914..1ba9007 100644 (file)
@@ -1,5 +1,10 @@
 2013-05-21  Richard Biener  <rguenther@suse.de>
 
+       PR tree-optimization/57330
+       * gcc.dg/torture/pr57330.c: New testcase.
+
+2013-05-21  Richard Biener  <rguenther@suse.de>
+
        PR tree-optimization/57303
        * gcc.dg/torture/pr57303.c: New testcase.
 
diff --git a/gcc/testsuite/gcc.dg/torture/pr57330.c b/gcc/testsuite/gcc.dg/torture/pr57330.c
new file mode 100644 (file)
index 0000000..3e6cbcb
--- /dev/null
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+
+void foo (int a)
+{}
+
+void *a;
+void bar ()
+{
+  void **( *b ) (  ) = (void**(*)()) foo;
+  a = b (0);
+}