This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]