re PR rtl-optimization/66076 (ICE: in vec_safe_grow, at vec.h:618 with -funroll-loops...
authorRichard Sandiford <richard.sandiford@arm.com>
Mon, 11 May 2015 09:35:53 +0000 (09:35 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Mon, 11 May 2015 09:35:53 +0000 (09:35 +0000)
gcc/
PR rtl-optimization/66076
* rtlanal.c (generic_subrtx_iterator <T>::add_single_to_queue):
Don't grow the heap array if it is already big enough from a
previous iteration.

gcc/testsuite/
PR rtl-optimization/66076
* gcc.dg/torture/pr66076.c: New test.

From-SVN: r222999

gcc/ChangeLog
gcc/rtlanal.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr66076.c [new file with mode: 0644]

index 88d8934bc117dcc758073ee3fb691809bbfc7ce6..5deba76159c21f044f7ef7c8e1d29d53917bfab3 100644 (file)
@@ -1,3 +1,10 @@
+2015-05-11  Richard Sandiford  <richard.sandiford@arm.com>
+
+       PR rtl-optimization/66076
+       * rtlanal.c (generic_subrtx_iterator <T>::add_single_to_queue):
+       Don't grow the heap array if it is already big enough from a
+       previous iteration.
+
 2015-05-11  Christian Bruel  <christian.bruel@st.com>
 
        * config/arm/arm-protos.h (arm_declare_function_name): Declare.
index 00d90809cb4918cb5216856dceb142e0a6e6042b..68d9931940328b880a9276d8d56fbc7b00367750 100644 (file)
@@ -104,7 +104,10 @@ generic_subrtx_iterator <T>::add_single_to_queue (array_type &array,
          return base;
        }
       gcc_checking_assert (i == LOCAL_ELEMS);
-      vec_safe_grow (array.heap, i + 1);
+      /* A previous iteration might also have moved from the stack to the
+        heap, in which case the heap array will already be big enough.  */
+      if (vec_safe_length (array.heap) <= i)
+       vec_safe_grow (array.heap, i + 1);
       base = array.heap->address ();
       memcpy (base, array.stack, sizeof (array.stack));
       base[LOCAL_ELEMS] = x;
index 9dda2942bb660caca08a8842252532f2f0353dac..3b327b75b7f241ce1e73f031976aac16fe50d7b1 100644 (file)
@@ -1,3 +1,8 @@
+2015-05-11  Richard Sandiford  <richard.sandiford@arm.com>
+
+       PR rtl-optimization/66076
+       * gcc.dg/torture/pr66076.c: New test.
+
 2015-05-10  Thomas Koenig  <tkoenig@gcc.gnu.org>
 
        PR fortran/66041
diff --git a/gcc/testsuite/gcc.dg/torture/pr66076.c b/gcc/testsuite/gcc.dg/torture/pr66076.c
new file mode 100644 (file)
index 0000000..7e7d34d
--- /dev/null
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "" } */
+/* { dg-options "-mno-prefer-avx128 -march=bdver4" { target i?86-*-* x86_64-*-* } } */
+
+void
+f0a (char *result, char *arg1, char *arg4, char temp_6)
+{
+  int idx = 0;
+  for (idx = 0; idx < 416; idx += 1)
+    result[idx] = (arg1[idx] + arg4[idx]) * temp_6;
+}