Commit 3b3b1e32 by Richard Henderson Committed by Richard Henderson

cfgcleanup.c (try_forward_edges): Detect infinite loops while jump threading.

        * cfgcleanup.c (try_forward_edges): Detect infinite loops while
        jump threading.

From-SVN: r48574
parent 98e40e83
2002-01-05 Richard Henderson <rth@redhat.com> 2002-01-05 Richard Henderson <rth@redhat.com>
* cfgcleanup.c (try_forward_edges): Detect infinite loops while
jump threading.
2002-01-05 Richard Henderson <rth@redhat.com>
* c-decl.c (c_expand_body): Don't call outlining_inline_function. * c-decl.c (c_expand_body): Don't call outlining_inline_function.
* integrate.c (output_inline_function): Likewise. * integrate.c (output_inline_function): Likewise.
* toplev.c (rest_of_compilation): Do it here instead. Move call * toplev.c (rest_of_compilation): Do it here instead. Move call
......
...@@ -412,12 +412,32 @@ try_forward_edges (mode, b) ...@@ -412,12 +412,32 @@ try_forward_edges (mode, b)
edge t = thread_jump (mode, e, target); edge t = thread_jump (mode, e, target);
if (t) if (t)
{ {
new_target = t->dest;
new_target_threaded = true;
if (!nthreaded_edges) if (!nthreaded_edges)
threaded_edges = xmalloc (sizeof (*threaded_edges) threaded_edges = xmalloc (sizeof (*threaded_edges)
* n_basic_blocks); * n_basic_blocks);
else
{
int i;
/* Detect an infinite loop across blocks not
including the start block. */
for (i = 0; i < nthreaded_edges; ++i)
if (threaded_edges[i] == t)
break;
if (i < nthreaded_edges)
break;
}
/* Detect an infinite loop across the start block. */
if (t->dest == b)
break;
if (nthreaded_edges >= n_basic_blocks)
abort ();
threaded_edges[nthreaded_edges++] = t; threaded_edges[nthreaded_edges++] = t;
new_target = t->dest;
new_target_threaded = true;
} }
} }
...@@ -504,7 +524,11 @@ try_forward_edges (mode, b) ...@@ -504,7 +524,11 @@ try_forward_edges (mode, b)
first->succ->count -= edge_count; first->succ->count -= edge_count;
first->frequency -= edge_frequency; first->frequency -= edge_frequency;
if (first->succ->succ_next) if (first->succ->succ_next)
t = threaded_edges [n++]; {
if (n >= nthreaded_edges)
abort ();
t = threaded_edges [n++];
}
else else
t = first->succ; t = first->succ;
......
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