Fix gcc_assert in expand_omp_for_static_chunk
authorTom de Vries <tom@codesourcery.com>
Thu, 3 Sep 2015 11:01:05 +0000 (11:01 +0000)
committerTom de Vries <vries@gcc.gnu.org>
Thu, 3 Sep 2015 11:01:05 +0000 (11:01 +0000)
2015-09-03  Tom de Vries  <tom@codesourcery.com>

PR tree-optimization/65637
* omp-low.c (expand_omp_for_static_chunk): Fix gcc_assert for the case
that head is NULL.

* gcc.dg/autopar/pr46099-2.c: New test.

From-SVN: r227436

gcc/ChangeLog
gcc/omp-low.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/autopar/pr46099-2.c [new file with mode: 0644]

index 86317e3e165572244734218088c5354f5eddd0b8..ae76185f51c2d6469844ebdb04a55fa8de703dce 100644 (file)
@@ -1,3 +1,9 @@
+2015-09-03  Tom de Vries  <tom@codesourcery.com>
+
+       PR tree-optimization/65637
+       * omp-low.c (expand_omp_for_static_chunk): Fix gcc_assert for the case
+       that head is NULL.
+
 2015-09-03  Tom de Vries  <tom@codesourcery.com>
 
        * omp-low.c (expand_omp_for_static_chunk): Handle simple latch bb.
index 16d192201920d045b53b5980beed365e83695f34..0995652c6d3f5e004df4e70a767fb255db4a6f52 100644 (file)
@@ -7326,7 +7326,7 @@ expand_omp_for_static_chunk (struct omp_region *region,
          locus = redirect_edge_var_map_location (vm);
          add_phi_arg (nphi, redirect_edge_var_map_def (vm), re, locus);
        }
-      gcc_assert (gsi_end_p (psi) && i == head->length ());
+      gcc_assert (gsi_end_p (psi) && (head == NULL || i == head->length ()));
       redirect_edge_var_map_clear (re);
       while (1)
        {
index 65ca8c4702e9769145a5d66b09eafb87c2fb3064..bfb7dd2dfb65df98ae0ccc698637b92bff07c504 100644 (file)
@@ -1,3 +1,8 @@
+2015-09-03  Tom de Vries  <tom@codesourcery.com>
+
+       PR tree-optimization/65637
+       * gcc.dg/autopar/pr46099-2.c: New test.
+
 2015-09-03  Naveen H.S  <Naveen.Hurugalawadi@caviumnetworks.com>
 
        PR middle-end/67351
diff --git a/gcc/testsuite/gcc.dg/autopar/pr46099-2.c b/gcc/testsuite/gcc.dg/autopar/pr46099-2.c
new file mode 100644 (file)
index 0000000..2883408
--- /dev/null
@@ -0,0 +1,5 @@
+/* PR tree-optimization/46099.  */
+/* { dg-do compile } */
+/* { dg-options "-ftree-parallelize-loops=2 -fcompare-debug -O --param parloops-chunk-size=100" } */
+
+#include "pr46099.c"