diff options
author | James A. Morrison <phython@gcc.gnu.org> | 2005-07-22 03:48:00 +0000 |
---|---|---|
committer | James A. Morrison <phython@gcc.gnu.org> | 2005-07-22 03:48:00 +0000 |
commit | b49ceb450ff7b91d81c54741f0fc9e49ea6f5f0e (patch) | |
tree | 3b38a25b4343c6d118a0f6eb45423b321ee9a217 /gcc | |
parent | b4db223f6e04a59bab5f87e23c812b3952024c64 (diff) | |
download | gcc-b49ceb450ff7b91d81c54741f0fc9e49ea6f5f0e.zip gcc-b49ceb450ff7b91d81c54741f0fc9e49ea6f5f0e.tar.gz gcc-b49ceb450ff7b91d81c54741f0fc9e49ea6f5f0e.tar.bz2 |
fold-const.c (fold_unary): Don't strip signed nops from ABS_EXPRs.
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.
From-SVN: r102269
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/fold-const.c | 9 |
2 files changed, 12 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2699e12..178432c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +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. + 2005-07-21 DJ Delorie <dj@redhat.com> * toplev.c (warn_deprecated_use): Add warning control to warning diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 20c94ef..9a9ea22 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: |