+2010-11-29 Zdenek Dvorak <rakdver@kam.uniff.cz>
+
+ PR tree-optimization/46675
+ * tree-ssa-loop-niter.c (split_to_var_and_offset): Avoid overflow
+ in offset calculation.
+
2010-11-29 Alexandre Oliva <aoliva@redhat.com>
PR debug/46258
+2010-11-29 Richard Guenther <rguenther@suse.de>
+ Zdenek Dvorak <rakdver@kam.uniff.cz>
+
+ PR tree-optimization/46675
+ * gcc.dg/pr46675.c: New test.
+
2010-11-28 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/aliasing2.adb (dg-final): Robustify pattern matching.
--- /dev/null
+/* { 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;
+}
*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: