This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
infinite loop in find_rgns
- From: "Sanjiv Kumar Gupta, Noida" <sanjivg at noida dot hcltech dot com>
- To: gcc at gcc dot gnu dot org
- Date: Mon, 31 Mar 2003 15:31:50 +0530
- Subject: infinite loop in find_rgns
Curious to know how does the following piece of code
in find_rgns works.
...
passed = sbitmap_alloc (nr_edges);
sbitmap_zero (passed);
.....
/* DFS traversal to find inner loops in the cfg. */
sp = -1;
while (1)
{
if (current_edge == 0 || TEST_BIT (passed, current_edge))
{
/* We have reached a leaf node or a node that was already
processed. Pop edges off the stack until we find
an edge that has not yet been processed. */
while (sp >= 0
&& (current_edge == 0 || TEST_BIT (passed, current_edge)))
{
/* Pop entry off the stack. */
current_edge = stack[sp--];
....
}
/* See if have finished the DFS tree traversal. */
if (sp < 0 && TEST_BIT (passed, current_edge))
break;
/* Nope, continue the traversal with the popped node. */
continue;
}
In my case , current_edge is 0 at start. This is running in
infinite loop then.
--Sanjiv