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: PATCH: Fix PR 9516


On Sat, Apr 05, 2003 at 11:38:43AM +0200, Christian Ehrhardt wrote:
> +	    if (TREE_VALUE (tmp) && safe_from_p (x, TREE_VALUE (tmp), 0))
> +	      return 0;

Buggy logic.

I've checked in a corrected version.


r~



Index: expr.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/expr.c,v
retrieving revision 1.517
diff -c -p -d -r1.517 expr.c
*** expr.c	1 Apr 2003 13:40:07 -0000	1.517
--- expr.c	8 Apr 2003 00:07:08 -0000
*************** safe_from_p (x, exp, top_p)
*** 6093,6114 ****
  
      case 'x':
        if (TREE_CODE (exp) == TREE_LIST)
! 	return ((TREE_VALUE (exp) == 0
! 		 || safe_from_p (x, TREE_VALUE (exp), 0))
! 		&& (TREE_CHAIN (exp) == 0
! 		    || safe_from_p (x, TREE_CHAIN (exp), 0)));
        else if (TREE_CODE (exp) == ERROR_MARK)
  	return 1;	/* An already-visited SAVE_EXPR? */
        else
  	return 0;
  
-     case '1':
-       return safe_from_p (x, TREE_OPERAND (exp, 0), 0);
- 
      case '2':
      case '<':
!       return (safe_from_p (x, TREE_OPERAND (exp, 0), 0)
! 	      && safe_from_p (x, TREE_OPERAND (exp, 1), 0));
  
      case 'e':
      case 'r':
--- 6093,6123 ----
  
      case 'x':
        if (TREE_CODE (exp) == TREE_LIST)
! 	{
! 	  while (1)
! 	    {
! 	      if (TREE_VALUE (exp) && !safe_from_p (x, TREE_VALUE (exp), 0))
! 		return 0;
! 	      exp = TREE_CHAIN (exp);
! 	      if (!exp)
! 		return 1;
! 	      if (TREE_CODE (exp) != TREE_LIST)
! 		return safe_from_p (x, exp, 0);
! 	    }
! 	}
        else if (TREE_CODE (exp) == ERROR_MARK)
  	return 1;	/* An already-visited SAVE_EXPR? */
        else
  	return 0;
  
      case '2':
      case '<':
!       if (!safe_from_p (x, TREE_OPERAND (exp, 1), 0))
! 	return 0;
!       /* FALLTHRU */
! 
!     case '1':
!       return safe_from_p (x, TREE_OPERAND (exp, 0), 0);
  
      case 'e':
      case 'r':


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