From 2a23183eba75e1b418b8a7ee83d1d1cf79aee9f7 Mon Sep 17 00:00:00 2001 From: Richard Stallman Date: Mon, 7 Sep 1992 21:22:56 +0000 Subject: [PATCH] (convert_for_assignment): Warn about constant integer overflow even if no conversion is involved. From-SVN: r2075 --- gcc/fold-const.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 6877b2c..126aac4 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) -- 2.7.4