From b8a914304da6ad15c03f90850858f97969809e95 Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Mon, 26 Apr 1993 19:12:11 -0400 Subject: [PATCH] (fold): Signedness matters for comparisons and right shifts. From-SVN: r4243 --- gcc/fold-const.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 43995c60a0b..5845489d256 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); -- 2.30.2