[tree-ssa] Fix for compile/20030416-1.c

law@redhat.com law@redhat.com
Wed Apr 16 16:04:00 GMT 2003


And here's the fix for compile/20030416-1.c.  Basically we just need to
handle empty statement nodes at the tail of a control structure.  It's
not terribly difficult.

Bootstrapped and regression tested.


	* tree-cfg.c (make_loop_expr_blocks): When determining the value for
	NEXT_BLOCK_LINK, correctly handle empty statement nodes at the
	end of the tree.
	(make_cond_expr_blocks, make_switch_expr_blocks): Likewise.
	(make_bind_expr_blocks): Likewise.

Index: tree-cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-cfg.c,v
retrieving revision 1.1.4.71
diff -c -3 -p -r1.1.4.71 tree-cfg.c
*** tree-cfg.c	9 Apr 2003 19:27:40 -0000	1.1.4.71
--- tree-cfg.c	16 Apr 2003 15:59:42 -0000
*************** make_loop_expr_blocks (loop_p, next_bloc
*** 434,440 ****
      {
        si = tsi_start (loop_p);
        tsi_next (&si);
!       if (!tsi_end_p (si))
  	next_block_link = *(tsi_container (si));
      }
  
--- 434,445 ----
      {
        si = tsi_start (loop_p);
        tsi_next (&si);
! 
!       /* Ignore any empty statements at the tail of this tree.  */
!       while (!tsi_end_p (si) && tsi_stmt (si) == NULL)
! 	tsi_next (&si);
! 
!       if (!tsi_end_p (si) && tsi_stmt (si) != NULL_TREE)
  	next_block_link = *(tsi_container (si));
      }
  
*************** make_cond_expr_blocks (cond_p, next_bloc
*** 464,470 ****
    /* Determine NEXT_BLOCK_LINK for statements inside the COND_EXPR body.  */
    si = tsi_start (cond_p);
    tsi_next (&si);
!   if (!tsi_end_p (si))
      next_block_link = *(tsi_container (si));
  
    STRIP_CONTAINERS (cond);
--- 469,480 ----
    /* Determine NEXT_BLOCK_LINK for statements inside the COND_EXPR body.  */
    si = tsi_start (cond_p);
    tsi_next (&si);
! 
!   /* Ignore any empty statements at the tail of this tree.  */
!   while (!tsi_end_p (si) && tsi_stmt (si) == NULL)
!     tsi_next (&si);
! 
!   if (!tsi_end_p (si) && tsi_stmt (si) != NULL_TREE)
      next_block_link = *(tsi_container (si));
  
    STRIP_CONTAINERS (cond);
*************** make_switch_expr_blocks (switch_e_p, nex
*** 495,501 ****
    /* Determine NEXT_BLOCK_LINK for statements inside the COND_EXPR body.  */
    si = tsi_start (switch_e_p);
    tsi_next (&si);
!   if (!tsi_end_p (si))
      next_block_link = *(tsi_container (si));
  
    STRIP_CONTAINERS (switch_e);
--- 505,516 ----
    /* Determine NEXT_BLOCK_LINK for statements inside the COND_EXPR body.  */
    si = tsi_start (switch_e_p);
    tsi_next (&si);
! 
!   /* Ignore any empty statements at the tail of this tree.  */
!   while (!tsi_end_p (si) && tsi_stmt (si) == NULL)
!     tsi_next (&si);
! 
!   if (!tsi_end_p (si) && tsi_stmt (si) != NULL_TREE)
      next_block_link = *(tsi_container (si));
  
    STRIP_CONTAINERS (switch_e);
*************** make_bind_expr_blocks (bind_p, next_bloc
*** 534,540 ****
       body.  */
    si = tsi_start (bind_p);
    tsi_next (&si);
!   if (!tsi_end_p (si))
      next_block_link = *(tsi_container (si));
  
    /* By passing the current block ENTRY to make_blocks, we will keep adding
--- 549,560 ----
       body.  */
    si = tsi_start (bind_p);
    tsi_next (&si);
! 
!   /* Ignore any empty statements at the tail of this tree.  */
!   while (!tsi_end_p (si) && tsi_stmt (si) == NULL)
!     tsi_next (&si);
! 
!   if (!tsi_end_p (si) && tsi_stmt (si) != NULL_TREE)
      next_block_link = *(tsi_container (si));
  
    /* By passing the current block ENTRY to make_blocks, we will keep adding





More information about the Gcc-patches mailing list