aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Glisse <marc.glisse@inria.fr>2013-05-14 14:06:27 +0200
committerMarc Glisse <glisse@gcc.gnu.org>2013-05-14 12:06:27 +0000
commitd4c52634cef1d2e86c3b460a1128e3301ecf769d (patch)
tree7b1f5f3eee75e4a26ff6eeaf75ffdb4e0d3c548d
parent2b2612629120fe1a8aaf46d126e5f2631ddc9cf8 (diff)
downloadgcc-d4c52634cef1d2e86c3b460a1128e3301ecf769d.zip
gcc-d4c52634cef1d2e86c3b460a1128e3301ecf769d.tar.gz
gcc-d4c52634cef1d2e86c3b460a1128e3301ecf769d.tar.bz2
re PR bootstrap/57266 (comparison between signed and unsigned integer expressions in fold_binary_loc breaks m68k bootstrap)
2013-05-14 Marc Glisse <marc.glisse@inria.fr> PR bootstrap/57266 * fold-const.c (fold_binary_loc) <shift>: Use an unsigned variable for the shift amount. Check that we shift by non-negative amounts. From-SVN: r198880
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/fold-const.c8
2 files changed, 11 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 15cafbb..76ab15d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2013-05-14 Marc Glisse <marc.glisse@inria.fr>
+
+ PR bootstrap/57266
+ * fold-const.c (fold_binary_loc) <shift>: Use an unsigned
+ variable for the shift amount. Check that we shift by non-negative
+ amounts.
+
2013-05-14 Chung-Lin Tang <cltang@codesourcery.com>
PR target/42017
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index cbd3445..5d6bbbb 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -12423,13 +12423,13 @@ fold_binary_loc (location_t loc,
prec = element_precision (type);
/* Turn (a OP c1) OP c2 into a OP (c1+c2). */
- if (TREE_CODE (op0) == code && host_integerp (arg1, false)
+ if (TREE_CODE (op0) == code && host_integerp (arg1, true)
&& TREE_INT_CST_LOW (arg1) < prec
- && host_integerp (TREE_OPERAND (arg0, 1), false)
+ && host_integerp (TREE_OPERAND (arg0, 1), true)
&& TREE_INT_CST_LOW (TREE_OPERAND (arg0, 1)) < prec)
{
- HOST_WIDE_INT low = (TREE_INT_CST_LOW (TREE_OPERAND (arg0, 1))
- + TREE_INT_CST_LOW (arg1));
+ unsigned int low = (TREE_INT_CST_LOW (TREE_OPERAND (arg0, 1))
+ + TREE_INT_CST_LOW (arg1));
/* Deal with a OP (c1 + c2) being undefined but (a OP c1) OP c2
being well defined. */