aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1992-07-04 16:44:05 +0000
committerRichard Stallman <rms@gnu.org>1992-07-04 16:44:05 +0000
commit4b3d5ea0f56ec8d796086c07f2f3b2526ea6e717 (patch)
treebcfce10b6911fee745659ca2c01c33218a6ce5ff /gcc
parent2416cbcd8b559c89ce1a664a14583b8006b58347 (diff)
downloadgcc-4b3d5ea0f56ec8d796086c07f2f3b2526ea6e717.zip
gcc-4b3d5ea0f56ec8d796086c07f2f3b2526ea6e717.tar.gz
gcc-4b3d5ea0f56ec8d796086c07f2f3b2526ea6e717.tar.bz2
*** empty log message ***
From-SVN: r1423
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fold-const.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index fac5602..ddd5614 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -1405,8 +1405,17 @@ fold_convert (t, arg1)
l = real_value_from_int_cst (TYPE_MIN_VALUE (type)),
x = TREE_REAL_CST (arg1),
u = real_value_from_int_cst (TYPE_MAX_VALUE (type));
- if (! ((REAL_VALUES_LESS (l, x) || REAL_VALUES_EQUAL (l, x))
- && (REAL_VALUES_LESS (x, u) || REAL_VALUES_EQUAL (x, u))))
+ /* See if X will be in range after truncation towards 0.
+ To compensate for truncation, move the bounds away from 0,
+ but reject if X exactly equals the adjusted bounds. */
+#ifdef REAL_ARITHMETIC
+ REAL_ARITHMETIC (l, MINUS_EXPR, l, dconst1);
+ REAL_ARITHMETIC (u, PLUS_EXPR, u, dconst1);
+#else
+ l--;
+ u++;
+#endif
+ if (! (REAL_VALUES_LESS (l, x) && REAL_VALUES_LESS (x, u)))
{
warning ("real constant out of range for integer conversion");
return t;