(convert_for_assignment): Warn about constant integer
authorRichard Stallman <rms@gnu.org>
Mon, 7 Sep 1992 21:22:56 +0000 (21:22 +0000)
committerRichard Stallman <rms@gnu.org>
Mon, 7 Sep 1992 21:22:56 +0000 (21:22 +0000)
overflow even if no conversion is involved.

From-SVN: r2075

gcc/fold-const.c

index 6877b2c..126aac4 100644 (file)
@@ -3238,11 +3238,13 @@ fold (expr)
              if (! TREE_UNSIGNED (type)
                  && TREE_INT_CST_HIGH (arg0) < 0)
                {
-                 if (TREE_INT_CST_LOW (arg0) == 0)
-                   t = build_int_2 (0, - TREE_INT_CST_HIGH (arg0));
-                 else
-                   t = build_int_2 (- TREE_INT_CST_LOW (arg0),
-                                    ~ TREE_INT_CST_HIGH (arg0));
+                 HOST_WIDE_INT low, high;
+                 int overflow = neg_double (TREE_INT_CST_LOW (arg0),
+                                            TREE_INT_CST_HIGH (arg0),
+                                            &low, &high);
+                 t = build_int_2 (low, high);
+                 TREE_TYPE (t) = type;
+                 force_fit_type (t, overflow);
                }
            }
          else if (TREE_CODE (arg0) == REAL_CST)