From: Richard Stallman Date: Mon, 7 Sep 1992 21:22:56 +0000 (+0000) Subject: (convert_for_assignment): Warn about constant integer X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2a23183eba75e1b418b8a7ee83d1d1cf79aee9f7;p=gcc.git (convert_for_assignment): Warn about constant integer overflow even if no conversion is involved. From-SVN: r2075 --- diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 6877b2c108b..126aac45677 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -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)