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]

Re: safe_from_p changes tree code


> Thanks for the attempt, but don't install this just yet.  See
> my hastily-typed changes below.

You mean, like the change included below? It is not an equivalent
transformation of the original code, unless I miss something.

If save_from_p returns 0, exp will be restored to SAVE_EXPR when we
return to the toplevel. There, it will go over save_expr_trees and
abort if one of them is not an ERROR_MARK.

I could not trigger this abort, so it might well be that you intent to
check some assertion.

Regards,
Martin

Wed Jul  2 20:45:44 1998  Martin von L÷wis  <loewis@informatik.hu-berlin.de>

	* expr.c (safe_from_p): Change code to ERROR_MARK only when not
	accessing nodes. Restore to SAVE_EXPR on 0 return.

Index: expr.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/expr.c,v
retrieving revision 1.82
diff -c -p -r1.82 expr.c
*** expr.c	1998/07/01 05:10:49	1.82
--- expr.c	1998/07/02 18:43:18
*************** safe_from_p (x, exp, top_p)
*** 4963,4975 ****
  	  if (save_expr_count >= save_expr_size)
  	    return 0;
  	  save_expr_rewritten[save_expr_count++] = exp;
- 	  TREE_SET_CODE (exp, ERROR_MARK);
  
  	  nops = tree_code_length[(int) SAVE_EXPR];
  	  for (i = 0; i < nops; i++)
! 	    if (TREE_OPERAND (exp, i) != 0
! 		&& ! safe_from_p (x, TREE_OPERAND (exp, i), 0))
! 	      return 0;
  	  return 1;
  
  	case BIND_EXPR:
--- 4963,4983 ----
  	  if (save_expr_count >= save_expr_size)
  	    return 0;
  	  save_expr_rewritten[save_expr_count++] = exp;
  
  	  nops = tree_code_length[(int) SAVE_EXPR];
  	  for (i = 0; i < nops; i++)
! 	    {
! 	      tree operand = TREE_OPERAND (exp, i);
! 	      int res;
! 	      if (operand == NULL_TREE)
! 		continue;
! 	      TREE_SET_CODE (exp, ERROR_MARK);
! 	      res = safe_from_p (x, operand, 0);
! 	      TREE_SET_CODE (exp, SAVE_EXPR);
! 	      if (res == 0)
! 		return 0;
! 	    }
! 	  TREE_SET_CODE (exp, ERROR_MARK);
  	  return 1;
  
  	case BIND_EXPR:


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