(shorten_compare): Do nothing if both args constant.
authorRichard Stallman <rms@gnu.org>
Sun, 31 Oct 1993 03:13:52 +0000 (03:13 +0000)
committerRichard Stallman <rms@gnu.org>
Sun, 31 Oct 1993 03:13:52 +0000 (03:13 +0000)
From-SVN: r5954

gcc/c-common.c

index a6e78260841a3e60760f23c81b811a8a62153605..37d0458e769045ba7faac31391f66a57c10c181e 100644 (file)
@@ -1259,6 +1259,13 @@ shorten_compare (op0_ptr, op1_ptr, restype_ptr, rescode_ptr)
   tree primop0, primop1;
   enum tree_code code = *rescode_ptr;
 
+  /* Don't do anything if both args are constant.
+     This avoids confusing warnings.  The caller will fold properly.  */
+  if ((TREE_CODE (op0) == INTEGER_CST || TREE_CODE (op0) == REAL_CST)
+      &&
+      (TREE_CODE (op1) == INTEGER_CST || TREE_CODE (op1) == REAL_CST))
+    return 0;
+
   /* Throw away any conversions to wider types
      already present in the operands.  */