diff mbox

[RFC] Make called function type explicit, make function pointer type conversions useless

Message ID 201104150954.13991.ebotcazou@adacore.com
State New
Headers show

Commit Message

Eric Botcazou April 15, 2011, 7:54 a.m. UTC
> 2011-04-14  Eric Botcazou  <ebotcazou@adacore.com>
>
> 	* cfgexpand.c (expand_call_stmt): Rematerialize the original function
> 	type if this is not a builtin function.

Hum, using fold_convert seems to be more appropriate here.

Bootstrapped/regtested on i586-suse-linux, applied as obvious.


2011-04-15  Eric Botcazou  <ebotcazou@adacore.com>

        * cfgexpand.c (expand_call_stmt): Simply convert the function type.
diff mbox

Patch

Index: cfgexpand.c
===================================================================
--- cfgexpand.c	(revision 172469)
+++ cfgexpand.c	(working copy)
@@ -1851,8 +1851,8 @@  expand_call_stmt (gimple stmt)
      call is made may be different from the type of the function.  */
   if (!builtin_p)
     CALL_EXPR_FN (exp)
-      = fold_build1 (NOP_EXPR, build_pointer_type (gimple_call_fntype (stmt)),
-		     CALL_EXPR_FN (exp));
+      = fold_convert (build_pointer_type (gimple_call_fntype (stmt)),
+		      CALL_EXPR_FN (exp));
 
   TREE_TYPE (exp) = gimple_call_return_type (stmt);
   CALL_EXPR_STATIC_CHAIN (exp) = gimple_call_chain (stmt);