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]

Improve type-consistency of tree in presence of folding


This fixes some ICEs when compiling the Ada library for sparc64-vxworks.

Tested on i686-pc-linux-gnu.

Sat Oct  5 09:51:33 2002  Olivier Hainque <hainque at act-europe dot fr>

	* fold-const.c (fold, case PLUS_EXPR and case MULT_EXPR): Restore
	a number of conversions required for type consistency and previously
	stripped off by STRIP_NOPS.

*** gcc/fold-const.c	16 Apr 2003 21:33:19 -0000	1.247
--- gcc/fold-const.c	18 Apr 2003 23:15:10 -0000
*************** extract_muldiv_1 (t, c, code, wide_type)
*** 4183,4188 ****
  	 we can, replace this expression with the inner simplification for
  	 possible later conversion to our or some other type.  */
!       if (0 != (t1 = extract_muldiv (op0, convert (TREE_TYPE (op0), c), code,
! 				     code == MULT_EXPR ? ctype : NULL_TREE)))
  	return t1;
        break;
--- 4183,4192 ----
  	 we can, replace this expression with the inner simplification for
  	 possible later conversion to our or some other type.  */
!       if ((t2 = convert (TREE_TYPE (op0), c)) != 0
! 	  && TREE_CODE (t2) == INTEGER_CST
! 	  && ! TREE_CONSTANT_OVERFLOW (t2)
! 	  && (0 != (t1 = extract_muldiv (op0, t2, code,
! 					 code == MULT_EXPR
! 					 ? ctype : NULL_TREE))))
  	return t1;
        break;
*************** fold (expr)
*** 5479,5489 ****
  		  && TREE_CODE (parg1) != MULT_EXPR)
  		return fold (build (PLUS_EXPR, type,
! 				    fold (build (PLUS_EXPR, type, parg0, marg)),
! 				    parg1));
  	      if (TREE_CODE (parg0) != MULT_EXPR
  		  && TREE_CODE (parg1) == MULT_EXPR)
  		return fold (build (PLUS_EXPR, type,
! 				    fold (build (PLUS_EXPR, type, parg1, marg)),
! 				    parg0));
  	    }
  
--- 5483,5497 ----
  		  && TREE_CODE (parg1) != MULT_EXPR)
  		return fold (build (PLUS_EXPR, type,
! 				    fold (build (PLUS_EXPR, type, 
! 						 convert (type, parg0), 
! 						 convert (type, marg))),
! 				    convert (type, parg1)));
  	      if (TREE_CODE (parg0) != MULT_EXPR
  		  && TREE_CODE (parg1) == MULT_EXPR)
  		return fold (build (PLUS_EXPR, type,
! 				    fold (build (PLUS_EXPR, type, 
! 						 convert (type, parg1), 
! 						 convert (type, marg))),
! 				    convert (type, parg0)));
  	    }
  
*************** fold (expr)
*** 5817,5821 ****
  
  	  if (TREE_CODE (arg1) == INTEGER_CST
! 	      && 0 != (tem = extract_muldiv (TREE_OPERAND (t, 0), arg1,
  					     code, NULL_TREE)))
  	    return convert (type, tem);
--- 5825,5830 ----
  
  	  if (TREE_CODE (arg1) == INTEGER_CST
! 	      && 0 != (tem = extract_muldiv (TREE_OPERAND (t, 0),
! 					     convert (type, arg1),
  					     code, NULL_TREE)))
  	    return convert (type, tem);


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