This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Improve type-consistency of tree in presence of folding
- From: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 21 Apr 03 18:33:18 EDT
- Subject: 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);