+2005-05-23 Ulrich Weigand <uweigand@de.ibm.com>
+
+ * unroll.c (loop_iterations): Remove common term from initial
+ and final value only if it is loop invariant.
+
2005-05-20 Mark Mitchell <mark@codesourcery.com>
* version.c (version_string): Mark as 3.4.5.
+2005-05-23 Ulrich Weigand <uweigand@de.ibm.com>
+
+ * gcc.dg/20050510-1.c: New test.
+
2005-05-19 Release Manager
* GCC 3.4.4 released.
--- /dev/null
+/* This used to abort due to incorrect loop iteration count computation. */
+
+/* { dg-do run } */
+/* { dg-options "-O2" } */
+
+int test (unsigned char *data)
+{
+ unsigned char *top;
+ unsigned char *bottom;
+ unsigned int i = 0;
+
+ for (bottom = data, top = data + 36;
+ top > bottom;
+ bottom++, top--)
+ {
+ i++;
+ }
+
+ return i;
+}
+
+int main (void)
+{
+ unsigned char buffer[36];
+
+ if (test (buffer) != 18)
+ abort ();
+
+ exit (0);
+}
+
??? Without a vtop we could still perform the optimization if we check
the initial and final values carefully. */
if (loop->vtop
- && (reg_term = find_common_reg_term (initial_value, final_value)))
+ && (reg_term = find_common_reg_term (initial_value, final_value))
+ && loop_invariant_p (loop, reg_term))
{
initial_value = subtract_reg_term (initial_value, reg_term);
final_value = subtract_reg_term (final_value, reg_term);