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]

Re: Java segfault in predict.c


Hello.

> The following Java code (extracted from xerces) results in a segfault 
> with the current mainline in estimate_probability at -O. This seems to 
> be a recent regression, certainly it does not fail with GCC 3.1. You 
> should be able to reproduce it with "gcj -c -O Crash.java"

This fixes the bug.

Zdenek Dvorak

Changelog:
	* cfgloop.c (flow_loops_find): Correctly initialize loop->first and
	loop->last.

Index: cfgloop.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgloop.c,v
retrieving revision 1.12
diff -c -3 -p -r1.12 cfgloop.c
*** cfgloop.c	28 May 2002 20:44:09 -0000	1.12
--- cfgloop.c	29 May 2002 08:32:50 -0000
*************** flow_loops_find (loops, flags)
*** 644,650 ****
    sbitmap *dom;
    int *dfs_order;
    int *rc_order;
!   basic_block header;
  
    /* This function cannot be repeatedly called with different
       flags to build up the loop information.  The loop tree
--- 644,650 ----
    sbitmap *dom;
    int *dfs_order;
    int *rc_order;
!   basic_block header, bb;
  
    /* This function cannot be repeatedly called with different
       flags to build up the loop information.  The loop tree
*************** flow_loops_find (loops, flags)
*** 768,777 ****
  	     These are often the same as the loop header and
  	     loop latch respectively, but this is not always
  	     the case.  */
! 	  loop->first
! 	    = BASIC_BLOCK (sbitmap_first_set_bit (loop->nodes));
! 	  loop->last
! 	    = BASIC_BLOCK (sbitmap_last_set_bit (loop->nodes));
  
  	  flow_loop_scan (loops, loop, flags);
  	}
--- 768,782 ----
  	     These are often the same as the loop header and
  	     loop latch respectively, but this is not always
  	     the case.  */
! 
! 	  FOR_BB_BETWEEN (bb, BASIC_BLOCK (sbitmap_first_set_bit (loop->nodes)),
! 		ENTRY_BLOCK_PTR, prev_bb)
! 	    if (TEST_BIT (loop->nodes, bb->index))
! 	      loop->first = bb;
! 	  FOR_BB_BETWEEN (bb, BASIC_BLOCK (sbitmap_last_set_bit (loop->nodes)),
! 		EXIT_BLOCK_PTR, next_bb)
! 	    if (TEST_BIT (loop->nodes, bb->index))
! 	      loop->last = bb;
  
  	  flow_loop_scan (loops, loop, flags);
  	}


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