aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1993-04-26 19:12:11 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1993-04-26 19:12:11 -0400
commitb8a914304da6ad15c03f90850858f97969809e95 (patch)
treec7b18f0e8e7f545675ce7ef8972dd3da7b9a1ac4 /gcc
parent3975f288c6896a87d5522912bdf29ec744e48e28 (diff)
downloadgcc-b8a914304da6ad15c03f90850858f97969809e95.zip
gcc-b8a914304da6ad15c03f90850858f97969809e95.tar.gz
gcc-b8a914304da6ad15c03f90850858f97969809e95.tar.bz2
(fold): Signedness matters for comparisons and right shifts.
From-SVN: r4243
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fold-const.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 43995c6..5845489 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -3040,8 +3040,17 @@ fold (expr)
if (op == 0)
continue; /* Valid for CALL_EXPR, at least. */
- /* Strip any conversions that don't change the mode. */
- STRIP_NOPS (op);
+ if (kind == '<' || code == RSHIFT_EXPR)
+ {
+ /* Signedness matters here. Perhaps we can refine this
+ later. */
+ STRIP_TYPE_NOPS (op);
+ }
+ else
+ {
+ /* Strip any conversions that don't change the mode. */
+ STRIP_NOPS (op);
+ }
if (TREE_CODE (op) == COMPLEX_CST)
subop = TREE_REALPART (op);