(fold): Signedness matters for comparisons and right shifts.
authorRichard Kenner <kenner@gcc.gnu.org>
Mon, 26 Apr 1993 23:12:11 +0000 (19:12 -0400)
committerRichard Kenner <kenner@gcc.gnu.org>
Mon, 26 Apr 1993 23:12:11 +0000 (19:12 -0400)
From-SVN: r4243

gcc/fold-const.c

index 43995c60a0b88b67421581f983225ec509c5c16f..5845489d2567a4b46eaacc27dc89fa45875f84a4 100644 (file)
@@ -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);