re PR c/9516 (Internal error when using a big array)

PR c/9516
        * expr.c (safe_from_p): Rearrange to avoid deep recursion in
        favour of looping and tail recursion for TREE_LIST and binops.

Co-Authored-By: Richard Henderson <rth@redhat.com>

From-SVN: r65363
This commit is contained in:
Christian Ehrhardt 2003-04-08 00:23:17 +00:00 committed by Richard Henderson
parent 12031a6266
commit f8d4be5756
2 changed files with 25 additions and 9 deletions

View File

@ -1,3 +1,10 @@
2003-04-07 Christian Ehrhardt <ehrhardt@mathematik.uni-ulm.de>
Richard Henderson <rth@redhat.com>
PR c/9516
* expr.c (safe_from_p): Rearrange to avoid deep recursion in
favour of looping and tail recursion for TREE_LIST and binops.
2003-04-08 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
* loop.h (REGNO_FIRST_LUID, REGNO_LAST_LUID): Provide defaults

View File

@ -6093,22 +6093,31 @@ safe_from_p (x, exp, top_p)
case 'x':
if (TREE_CODE (exp) == TREE_LIST)
return ((TREE_VALUE (exp) == 0
|| safe_from_p (x, TREE_VALUE (exp), 0))
&& (TREE_CHAIN (exp) == 0
|| safe_from_p (x, TREE_CHAIN (exp), 0)));
{
while (1)
{
if (TREE_VALUE (exp) && !safe_from_p (x, TREE_VALUE (exp), 0))
return 0;
exp = TREE_CHAIN (exp);
if (!exp)
return 1;
if (TREE_CODE (exp) != TREE_LIST)
return safe_from_p (x, exp, 0);
}
}
else if (TREE_CODE (exp) == ERROR_MARK)
return 1; /* An already-visited SAVE_EXPR? */
else
return 0;
case '1':
return safe_from_p (x, TREE_OPERAND (exp, 0), 0);
case '2':
case '<':
return (safe_from_p (x, TREE_OPERAND (exp, 0), 0)
&& safe_from_p (x, TREE_OPERAND (exp, 1), 0));
if (!safe_from_p (x, TREE_OPERAND (exp, 1), 0))
return 0;
/* FALLTHRU */
case '1':
return safe_from_p (x, TREE_OPERAND (exp, 0), 0);
case 'e':
case 'r':