[PATCH] Fix PR24470

Richard Guenther rguenther@suse.de
Fri Oct 21 12:15:00 GMT 2005


This fixes PR24470, running in circles during folding a COND_EXPR with
some unfolded operands.  After trying to track down a fix for the
underlying problem for 2 hours, got back to the papering-over solution.
3.4 is not worth more time.

Bootstrap and regtests will very likely succeed for this one, ok for
3.4 branch if they really do?

Thanks,
Richard.


2005-10-21  Richard Guenther  <rguenther@suse.de>

	PR middle-end/24470
	* fold-const.c (fold): Avoid running in circles if we
	got some un-folded subtree.

Index: fold-const.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fold-const.c,v
retrieving revision 1.322.2.19
diff -c -3 -p -r1.322.2.19 fold-const.c
*** fold-const.c	9 Sep 2005 10:19:52 -0000	1.322.2.19
--- fold-const.c	21 Oct 2005 11:00:08 -0000
*************** fold (tree expr)
*** 8142,8148 ****
  
  	  if (INTEGRAL_TYPE_P (type)
  	      && TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST
! 	      && TREE_CODE (arg2) == INTEGER_CST)
  	    switch (comp_code)
  	      {
  	      case EQ_EXPR:
--- 8142,8153 ----
  
  	  if (INTEGRAL_TYPE_P (type)
  	      && TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST
! 	      && TREE_CODE (arg2) == INTEGER_CST
! 	      /* ???  We somehow can end up here with
! 		  (unsigned int)1 == 1 ? 1U : 2U
! 		 for which we won't make any progress but recurse
! 		 indefinitely.  Just stop here in this case.  */
! 	      && TREE_CODE (arg1) != INTEGER_CST)
  	    switch (comp_code)
  	      {
  	      case EQ_EXPR:



More information about the Gcc-patches mailing list