summaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>1998-09-20 12:37:58 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>1998-09-20 12:37:58 +0000
commitf757c65cfb0b13e7aced379ba88228034da22dbc (patch)
tree7aca1efede51bf0b68888064d5cf85afaacedb30 /gcc/fold-const.c
parent9e8c0a0f8ffa7cf11ef8db1d50527b00beae5c62 (diff)
downloadgcc-f757c65cfb0b13e7aced379ba88228034da22dbc.tar.gz
* fold-const.c (fold): Yet another COND_EXPR bug: when folding
to an ABS expr, convert an unsigned input to signed. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@22503 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index b7037deeea7..0d04e91160b 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -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,