Commit 292e35a3 by Christian Ehrhardt Committed by Richard Henderson

re PR rtl-optimization/7507 (ICE (segfault) with -O2)

        PR opt/7507
        * calls.c (fix_unsafe_tree): Split out from ...
        (expand_call): ... here.  Use it on the function address too.

From-SVN: r61539
parent d8d0f5af
2003-01-21 Christian Ehrhardt <ehrhardt@mathematik.uni-ulm.de>
PR opt/7507
* calls.c (fix_unsafe_tree): Split out from ...
(expand_call): ... here. Use it on the function address too.
2003-01-20 Richard Henderson <rth@redhat.com> 2003-01-20 Richard Henderson <rth@redhat.com>
* expr.h (default_must_pass_in_stack): Move decl outside ifdef. * expr.h (default_must_pass_in_stack): Move decl outside ifdef.
......
...@@ -2068,6 +2068,35 @@ check_sibcall_argument_overlap (insn, arg, mark_stored_args_map) ...@@ -2068,6 +2068,35 @@ check_sibcall_argument_overlap (insn, arg, mark_stored_args_map)
return insn != NULL_RTX; return insn != NULL_RTX;
} }
static tree
fix_unsafe_tree (t)
tree t;
{
switch (unsafe_for_reeval (t))
{
case 0: /* Safe. */
break;
case 1: /* Mildly unsafe. */
t = unsave_expr (t);
break;
case 2: /* Wildly unsafe. */
{
tree var = build_decl (VAR_DECL, NULL_TREE,
TREE_TYPE (t));
SET_DECL_RTL (var,
expand_expr (t, NULL_RTX, VOIDmode, EXPAND_NORMAL));
t = var;
}
break;
default:
abort ();
}
return t;
}
/* Generate all the code for a function call /* Generate all the code for a function call
and return an rtx for its value. and return an rtx for its value.
Store the value in TARGET (specified as an rtx) if convenient. Store the value in TARGET (specified as an rtx) if convenient.
...@@ -2516,35 +2545,16 @@ expand_call (exp, target, ignore) ...@@ -2516,35 +2545,16 @@ expand_call (exp, target, ignore)
for (; i != end; i += inc) for (; i != end; i += inc)
{ {
switch (unsafe_for_reeval (args[i].tree_value)) args[i].tree_value = fix_unsafe_tree (args[i].tree_value);
{
case 0: /* Safe. */
break;
case 1: /* Mildly unsafe. */
args[i].tree_value = unsave_expr (args[i].tree_value);
break;
case 2: /* Wildly unsafe. */
{
tree var = build_decl (VAR_DECL, NULL_TREE,
TREE_TYPE (args[i].tree_value));
SET_DECL_RTL (var,
expand_expr (args[i].tree_value, NULL_RTX,
VOIDmode, EXPAND_NORMAL));
args[i].tree_value = var;
}
break;
default:
abort ();
}
/* We need to build actparms for optimize_tail_recursion. We can /* We need to build actparms for optimize_tail_recursion. We can
safely trash away TREE_PURPOSE, since it is unused by this safely trash away TREE_PURPOSE, since it is unused by this
function. */ function. */
if (try_tail_recursion) if (try_tail_recursion)
actparms = tree_cons (NULL_TREE, args[i].tree_value, actparms); actparms = tree_cons (NULL_TREE, args[i].tree_value, actparms);
} }
/* Do the same for the function address if it is an expression. */
if (!fndecl)
TREE_OPERAND (exp, 0) = fix_unsafe_tree (TREE_OPERAND (exp, 0));
/* Expanding one of those dangerous arguments could have added /* Expanding one of those dangerous arguments could have added
cleanups, but otherwise give it a whirl. */ cleanups, but otherwise give it a whirl. */
if (any_pending_cleanups (1)) if (any_pending_cleanups (1))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment