This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: egcs-20000306 ICE in `size_binop', at fold-const.c:1873
- To: mark at codesourcery dot com
- Subject: Re: egcs-20000306 ICE in `size_binop', at fold-const.c:1873
- From: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- Date: Thu, 16 Mar 00 18:58:26 EST
- Cc: gcc-patches at gcc dot gnu dot org
The posted patch was indeed wrong. This is caused by, of all things, a
bug in fold-const.c where fold returns a tree of a different type than the
input in some cases. I looked around to find some more cases and fixed them
as well, but I'm sure there'll be more of these. One day, we should
turn on checking in "build" to verify the types of operands: I'll bet we
find *all kinds* of type bugs in the compiler.
Anyway, I commited this patch:
Thu Mar 16 18:52:32 2000 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* fold-const.c (fold): Fix a few cases when the returned result
is not of the same type as the input.
*** fold-const.c 2000/03/07 11:41:19 1.108
--- fold-const.c 2000/03/16 23:32:34
*************** fold (expr)
*** 5227,5231 ****
return arg0;
else if (TREE_CODE (arg0) == COMPLEX_EXPR)
! return build (COMPLEX_EXPR, TREE_TYPE (arg0),
TREE_OPERAND (arg0, 0),
negate_expr (TREE_OPERAND (arg0, 1)));
--- 5227,5231 ----
return arg0;
else if (TREE_CODE (arg0) == COMPLEX_EXPR)
! return build (COMPLEX_EXPR, type,
TREE_OPERAND (arg0, 0),
negate_expr (TREE_OPERAND (arg0, 1)));
*************** fold (expr)
*** 5526,5530 ****
{
if (! wins && integer_zerop (arg0))
! return negate_expr (arg1);
if (integer_zerop (arg1))
return non_lvalue (convert (type, arg0));
--- 5526,5530 ----
{
if (! wins && integer_zerop (arg0))
! return convert (type, negate_expr (arg1));
if (integer_zerop (arg1))
return non_lvalue (convert (type, arg0));
*************** fold (expr)
*** 5549,5553 ****
/* Except with IEEE floating point, 0-x equals -x. */
if (! wins && real_zerop (arg0))
! return negate_expr (arg1);
/* Except with IEEE floating point, x-0 equals x. */
if (real_zerop (arg1))
--- 5549,5553 ----
/* Except with IEEE floating point, 0-x equals -x. */
if (! wins && real_zerop (arg0))
! return convert (type, negate_expr (arg1));
/* Except with IEEE floating point, x-0 equals x. */
if (real_zerop (arg1))
*************** fold (expr)
*** 6820,6824 ****
{
case EQ_EXPR:
! return pedantic_non_lvalue (negate_expr (arg1));
case NE_EXPR:
return pedantic_non_lvalue (convert (type, arg1));
--- 6820,6825 ----
{
case EQ_EXPR:
! return
! pedantic_non_lvalue (convert (type, negate_expr (arg1)));
case NE_EXPR:
return pedantic_non_lvalue (convert (type, arg1));