===================================================================
@@ -95,10 +95,10 @@ split_to_var_and_offset (tree expr, tree
*var = op0;
/* Always sign extend the offset. */
off = tree_to_double_int (op1);
- if (negate)
- off = double_int_neg (off);
off = double_int_sext (off, TYPE_PRECISION (type));
mpz_set_double_int (offset, off, false);
+ if (negate)
+ mpz_neg (offset, offset);
break;
case INTEGER_CST:
===================================================================
@@ -0,0 +1,29 @@
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+extern void abort (void);
+
+int j;
+
+void
+__attribute__((noinline))
+foo (int n)
+{
+ int npairs, i;
+ npairs = n - (-__INT_MAX__ - 1);
+
+ if (npairs > 0)
+ for (i = 0; i < npairs; i++)
+ j++;
+}
+
+int
+main ()
+{
+ foo (5 - __INT_MAX__ - 1);
+
+ if (j != 5)
+ abort ();
+
+ return 0;
+}