aboutsummaryrefslogtreecommitdiff
path: root/gcc/cfgexpand.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2011-04-14 21:56:34 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2011-04-14 21:56:34 +0000
commite792558227b3d53747e74e3af801fe8faba09290 (patch)
tree67e0575f05f86ecdf4777e969cf9afd3591f7de1 /gcc/cfgexpand.c
parent09db7afe4f724be4582250bd68a0110a60896e95 (diff)
downloadgcc-e792558227b3d53747e74e3af801fe8faba09290.zip
gcc-e792558227b3d53747e74e3af801fe8faba09290.tar.gz
gcc-e792558227b3d53747e74e3af801fe8faba09290.tar.bz2
cfgexpand.c (expand_call_stmt): Rematerialize the original function type if this is not a builtin function.
* cfgexpand.c (expand_call_stmt): Rematerialize the original function type if this is not a builtin function. From-SVN: r172459
Diffstat (limited to 'gcc/cfgexpand.c')
-rw-r--r--gcc/cfgexpand.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index d84c57e..45a6383 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -1837,11 +1837,9 @@ expand_gimple_cond (basic_block bb, gimple stmt)
static void
expand_call_stmt (gimple stmt)
{
- tree exp;
- tree lhs = gimple_call_lhs (stmt);
- size_t i;
+ tree exp, decl, lhs = gimple_call_lhs (stmt);
bool builtin_p;
- tree decl;
+ size_t i;
exp = build_vl_exp (CALL_EXPR, gimple_call_num_args (stmt) + 3);
@@ -1849,6 +1847,13 @@ expand_call_stmt (gimple stmt)
decl = gimple_call_fndecl (stmt);
builtin_p = decl && DECL_BUILT_IN (decl);
+ /* If this is not a builtin function, the function type through which the
+ 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));
+
TREE_TYPE (exp) = gimple_call_return_type (stmt);
CALL_EXPR_STATIC_CHAIN (exp) = gimple_call_chain (stmt);