summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1992-09-07 21:22:56 +0000
committerRichard Stallman <rms@gnu.org>1992-09-07 21:22:56 +0000
commit2a23183eba75e1b418b8a7ee83d1d1cf79aee9f7 (patch)
tree2e3a8bd00cbd729621654efbe4d5d02ed4ee2096 /gcc
parent850cba2976f2d33587954adae6590006289be618 (diff)
downloadgcc-2a23183eba75e1b418b8a7ee83d1d1cf79aee9f7.tar.gz
(convert_for_assignment): Warn about constant integer
overflow even if no conversion is involved. From-SVN: r2075
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fold-const.c12
1 files changed, 7 insertions, 5 deletions
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)