fold-const.c (fold): Yet another COND_EXPR bug...

* fold-const.c (fold): Yet another COND_EXPR bug: when folding
        to an ABS expr, convert an unsigned input to signed.

From-SVN: r22503
This commit is contained in:
Richard Henderson 1998-09-20 05:37:58 -07:00 committed by Richard Henderson
parent 056a3b121c
commit 899f1ed698
2 changed files with 9 additions and 0 deletions

View File

@ -1,3 +1,8 @@
Sun Sep 20 12:35:55 1998 Richard Henderson <rth@cygnus.com>
* fold-const.c (fold): Yet another COND_EXPR bug: when folding
to an ABS expr, convert an unsigned input to signed.
Sun Sep 20 12:14:45 1998 Jeffrey A Law (law@cygnus.com)
* fold-const.c (fold): Fix another type in COND_EXPR handling code.

View File

@ -5863,11 +5863,15 @@ fold (expr)
return pedantic_non_lvalue (convert (type, arg1));
case GE_EXPR:
case GT_EXPR:
if (TREE_UNSIGNED (TREE_TYPE (arg1)))
arg1 = convert (signed_type (TREE_TYPE (arg1)), arg1);
return pedantic_non_lvalue
(convert (type, fold (build1 (ABS_EXPR,
TREE_TYPE (arg1), arg1))));
case LE_EXPR:
case LT_EXPR:
if (TREE_UNSIGNED (TREE_TYPE (arg1)))
arg1 = convert (signed_type (TREE_TYPE (arg1)), arg1);
return pedantic_non_lvalue
(fold (build1 (NEGATE_EXPR, type,
convert (type,