Commit 899f1ed6 by Richard Henderson Committed by Richard Henderson

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
parent 056a3b12
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) 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. * fold-const.c (fold): Fix another type in COND_EXPR handling code.
......
...@@ -5863,11 +5863,15 @@ fold (expr) ...@@ -5863,11 +5863,15 @@ fold (expr)
return pedantic_non_lvalue (convert (type, arg1)); return pedantic_non_lvalue (convert (type, arg1));
case GE_EXPR: case GE_EXPR:
case GT_EXPR: case GT_EXPR:
if (TREE_UNSIGNED (TREE_TYPE (arg1)))
arg1 = convert (signed_type (TREE_TYPE (arg1)), arg1);
return pedantic_non_lvalue return pedantic_non_lvalue
(convert (type, fold (build1 (ABS_EXPR, (convert (type, fold (build1 (ABS_EXPR,
TREE_TYPE (arg1), arg1)))); TREE_TYPE (arg1), arg1))));
case LE_EXPR: case LE_EXPR:
case LT_EXPR: case LT_EXPR:
if (TREE_UNSIGNED (TREE_TYPE (arg1)))
arg1 = convert (signed_type (TREE_TYPE (arg1)), arg1);
return pedantic_non_lvalue return pedantic_non_lvalue
(fold (build1 (NEGATE_EXPR, type, (fold (build1 (NEGATE_EXPR, type,
convert (type, convert (type,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment