aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorJames A. Morrison <phython@gcc.gnu.org>2005-07-22 03:48:00 +0000
committerJames A. Morrison <phython@gcc.gnu.org>2005-07-22 03:48:00 +0000
commitd4141ac6874699efe26cad2076096a9950b934fb (patch)
tree3b38a25b4343c6d118a0f6eb45423b321ee9a217 /gcc/fold-const.c
parente162725bb13d5de3afe22417239728240b6e0aca (diff)
2005-07-21 James A. Morrison <phython@gcc.gnu.org>
* fold-const.c (fold_unary): Don't strip signed nops from ABS_EXPRs. (tree_expr_nonnegative_p): Return try for TYPE_UNSIGNED. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@102269 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 20c94efedef..9a9ea2246c0 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -6524,9 +6524,11 @@ fold_unary (enum tree_code code, tree type, tree op0)
arg0 = op0;
if (arg0)
{
- if (code == NOP_EXPR || code == FLOAT_EXPR || code == CONVERT_EXPR)
+ if (code == NOP_EXPR || code == CONVERT_EXPR
+ || code == FLOAT_EXPR || code == ABS_EXPR)
{
- /* Don't use STRIP_NOPS, because signedness of argument type matters. */
+ /* Don't use STRIP_NOPS, because signedness of argument type
+ matters. */
STRIP_SIGN_NOPS (arg0);
}
else
@@ -10686,6 +10688,9 @@ multiple_of_p (tree type, tree top, tree bottom)
int
tree_expr_nonnegative_p (tree t)
{
+ if (TYPE_UNSIGNED (TREE_TYPE (t)))
+ return 1;
+
switch (TREE_CODE (t))
{
case ABS_EXPR: