aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Wehle <john@feith.com>2000-01-09 06:03:45 +0000
committerJohn Wehle <wehle@gcc.gnu.org>2000-01-09 06:03:45 +0000
commitcb0a34c469abd6fc7e6a54fe620706ff0f2f136f (patch)
tree929408d70ce3a7b84c9acd4f8f43cf1758d6a7b5
parentd511f9d5ecc8d4f5a7a6dc1ba239ad67e0816773 (diff)
downloadgcc-cb0a34c469abd6fc7e6a54fe620706ff0f2f136f.zip
gcc-cb0a34c469abd6fc7e6a54fe620706ff0f2f136f.tar.gz
gcc-cb0a34c469abd6fc7e6a54fe620706ff0f2f136f.tar.bz2
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
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/fold-const.c18
2 files changed, 21 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c5c131f..ade9b9d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 976cf3a..64d4e41 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -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)