Commit cb0a34c4 by John Wehle Committed by John Wehle

fold-const.c (lshift_double, [...]): Handle shifting by 2 * HOST_BITS_PER_WIDE_INT correctly.

	* fold-const.c (lshift_double, rshift_double): Handle
	shifting by 2 * HOST_BITS_PER_WIDE_INT correctly.

From-SVN: r31289
parent d511f9d5
Sun Jan 9 01:02:55 EST 2000 John Wehle (john@feith.com)
* fold-const.c (lshift_double, rshift_double): Handle
shifting by 2 * HOST_BITS_PER_WIDE_INT correctly.
2000-01-08 Alexandre Oliva <oliva@lsd.ic.unicamp.br> 2000-01-08 Alexandre Oliva <oliva@lsd.ic.unicamp.br>
* toplev.c (rest_of_compilation): Initialize cse_not_expected as * toplev.c (rest_of_compilation): Initialize cse_not_expected as
......
...@@ -363,7 +363,14 @@ lshift_double (l1, h1, count, prec, lv, hv, arith) ...@@ -363,7 +363,14 @@ lshift_double (l1, h1, count, prec, lv, hv, arith)
count %= prec; count %= prec;
#endif #endif
if (count >= HOST_BITS_PER_WIDE_INT) if (count >= 2 * HOST_BITS_PER_WIDE_INT)
{
/* Shifting by the host word size is undefined according to the
ANSI standard, so we must handle this as a special case. */
*hv = 0;
*lv = 0;
}
else if (count >= HOST_BITS_PER_WIDE_INT)
{ {
*hv = (unsigned HOST_WIDE_INT) l1 << (count - HOST_BITS_PER_WIDE_INT); *hv = (unsigned HOST_WIDE_INT) l1 << (count - HOST_BITS_PER_WIDE_INT);
*lv = 0; *lv = 0;
...@@ -398,7 +405,14 @@ rshift_double (l1, h1, count, prec, lv, hv, arith) ...@@ -398,7 +405,14 @@ rshift_double (l1, h1, count, prec, lv, hv, arith)
count %= prec; count %= prec;
#endif #endif
if (count >= HOST_BITS_PER_WIDE_INT) if (count >= 2 * HOST_BITS_PER_WIDE_INT)
{
/* Shifting by the host word size is undefined according to the
ANSI standard, so we must handle this as a special case. */
*hv = signmask;
*lv = signmask;
}
else if (count >= HOST_BITS_PER_WIDE_INT)
{ {
*hv = signmask; *hv = signmask;
*lv = ((signmask << (2 * HOST_BITS_PER_WIDE_INT - count - 1) << 1) *lv = ((signmask << (2 * HOST_BITS_PER_WIDE_INT - count - 1) << 1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment