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
This commit is contained in:
John Wehle 2000-01-09 06:03:45 +00:00 committed by John Wehle
parent d511f9d5ec
commit cb0a34c469
2 changed files with 21 additions and 2 deletions

View File

@ -1,3 +1,8 @@
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>
* toplev.c (rest_of_compilation): Initialize cse_not_expected as

View File

@ -363,7 +363,14 @@ lshift_double (l1, h1, count, prec, lv, hv, arith)
count %= prec;
#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);
*lv = 0;
@ -398,7 +405,14 @@ rshift_double (l1, h1, count, prec, lv, hv, arith)
count %= prec;
#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;
*lv = ((signmask << (2 * HOST_BITS_PER_WIDE_INT - count - 1) << 1)