This is the mail archive of the gcc-patches@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: Fix a tcb crash and a potential bug on mainline


On Friday 22 October 2004 21:50, Jeffrey A Law wrote:
> Cool.  Let me know how it goes.

Bootstrapped and tested on i686-suse-linux-gnu, and I
verified with GDB that the PHI is still removed at least
for emptyif.f90.

Gr.
Steven

	* tree-phinodes.c (remove_phi_arg_num): Don't remove PHIs
	without any PHI arguments left.  Make sure the argument that
	we're supposed to remove exists at all.

Index: tree-phinodes.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-phinodes.c,v
retrieving revision 2.9
diff -c -3 -p -r2.9 tree-phinodes.c
*** tree-phinodes.c	29 Sep 2004 21:23:35 -0000	2.9
--- tree-phinodes.c	24 Oct 2004 19:54:36 -0000
*************** remove_phi_arg_num (tree phi, int i)
*** 407,412 ****
--- 407,414 ----
  {
    int num_elem = PHI_NUM_ARGS (phi);
  
+   gcc_assert (i < num_elem);
+ 
    /* If we are not at the last element, switch the last element
       with the element we want to delete.  */
    if (i != num_elem - 1)
*************** remove_phi_arg_num (tree phi, int i)
*** 421,431 ****
    PHI_ARG_EDGE (phi, num_elem - 1) = NULL;
    PHI_ARG_NONZERO (phi, num_elem - 1) = false;
    PHI_NUM_ARGS (phi)--;
- 
-   /* If we removed the last PHI argument, then go ahead and
-      remove the PHI node.  */
-   if (PHI_NUM_ARGS (phi) == 0)
-     remove_phi_node (phi, NULL, bb_for_stmt (phi));
  }
  
  /* Remove PHI node PHI from basic block BB.  If PREV is non-NULL, it is
--- 423,428 ----


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