From: Richard Stallman Date: Sat, 19 Sep 1992 19:00:40 +0000 (+0000) Subject: (fold_convert): Avoid using conversion of unsigned X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b6b19f41c6f312715ed7d64f5ce1e9b22ca5092b;p=gcc.git (fold_convert): Avoid using conversion of unsigned to floating; offset value by hand to fit in signed type. From-SVN: r2165 --- diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 126aac45677..f2aa59fd57d 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -1517,7 +1517,13 @@ fold_convert (t, arg1) high = (HOST_WIDE_INT) (d / half_word / half_word); d -= (REAL_VALUE_TYPE) high * half_word * half_word; - low = (unsigned HOST_WIDE_INT) d; + if (d >= (REAL_VALUE_TYPE) half_word * half_word / 2) + { + low = d - (REAL_VALUE_TYPE) half_word * half_word / 2; + low |= 1 << (HOST_BITS_PER_WIDE_INT - 1); + } + else + low = (HOST_WIDE_INT) d; if (TREE_REAL_CST (arg1) < 0) neg_double (low, high, &low, &high); t = build_int_2 (low, high);