re PR fortran/78299 (ICE in expand_omp_for_static_nochunk, at omp-low.c:9622)
authorJakub Jelinek <jakub@redhat.com>
Wed, 16 Nov 2016 18:19:09 +0000 (19:19 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 16 Nov 2016 18:19:09 +0000 (19:19 +0100)
PR fortran/78299
* omp-low.c (expand_omp_for_static_nochunk): Don't assert
that loop->header == body_bb if broken_loop.

* gfortran.dg/gomp/pr78299.f90: New test.

From-SVN: r242507

gcc/ChangeLog
gcc/omp-low.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/gomp/pr78299.f90 [new file with mode: 0644]

index a5290bafc4a7fa8cf940f851f1415d8361c4bd48..5d90c17021d71d54b84f87af26ff7a235243e651 100644 (file)
@@ -1,3 +1,9 @@
+2016-11-16  Jakub Jelinek  <jakub@redhat.com>
+
+       PR fortran/78299
+       * omp-low.c (expand_omp_for_static_nochunk): Don't assert
+       that loop->header == body_bb if broken_loop.
+
 2015-11-16  Wilco Dijkstra  <wdijkstr@arm.com>
 
        * tree-ssa-math-opts.c (bswap_replace): Remove test
index 331da6a1bef5a638d74d96f69c7a26bb2a65d7e3..7c58c033ded4168bc0080698c7f3d5936c47195e 100644 (file)
@@ -9685,7 +9685,7 @@ expand_omp_for_static_nochunk (struct omp_region *region,
   struct loop *loop = body_bb->loop_father;
   if (loop != entry_bb->loop_father)
     {
-      gcc_assert (loop->header == body_bb);
+      gcc_assert (broken_loop || loop->header == body_bb);
       gcc_assert (broken_loop
                  || loop->latch == region->cont
                  || single_pred (loop->latch) == region->cont);
index 3f8831e066afbc98f110f914367685ec1f60ac6c..e095a40262706f87956c24725c847f561983d015 100644 (file)
@@ -1,3 +1,8 @@
+2016-11-16  Jakub Jelinek  <jakub@redhat.com>
+
+       PR fortran/78299
+       * gfortran.dg/gomp/pr78299.f90: New test.
+
 2015-11-16  Wilco Dijkstra  <wdijkstr@arm.com>
 
        * gcc.dg/optimize-bswapdi-3.c: Remove xfail.
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr78299.f90 b/gcc/testsuite/gfortran.dg/gomp/pr78299.f90
new file mode 100644 (file)
index 0000000..d791e5a
--- /dev/null
@@ -0,0 +1,55 @@
+! PR fortran/78299
+! { dg-do compile }
+! { dg-additional-options "-fcheck=bounds" }
+
+program pr78299
+  integer, parameter :: n = 8
+  integer :: i, j
+  real :: x(n), y(n)
+  x = 1.0
+  y = 2.0
+  do j = 1, 9
+    !$omp parallel workshare
+    !$omp parallel default(shared)
+    !$omp do
+    do i = 1, n
+      x(i) = x(i) * y(9)               ! { dg-warning "is out of bounds" }
+    end do
+    !$omp end do
+    !$omp end parallel
+    !$omp end parallel workshare
+  end do
+  do j = 1, 9
+    !$omp parallel workshare
+    !$omp parallel default(shared)
+    !$omp do schedule(static)
+    do i = 1, n
+      x(i) = x(i) * y(9)               ! { dg-warning "is out of bounds" }
+    end do
+    !$omp end do
+    !$omp end parallel
+    !$omp end parallel workshare
+  end do
+  do j = 1, 9
+    !$omp parallel workshare
+    !$omp parallel default(shared)
+    !$omp do schedule(static, 2)
+    do i = 1, n
+      x(i) = x(i) * y(9)               ! { dg-warning "is out of bounds" }
+    end do
+    !$omp end do
+    !$omp end parallel
+    !$omp end parallel workshare
+  end do
+  do j = 1, 9
+    !$omp parallel workshare
+    !$omp parallel default(shared)
+    !$omp do schedule(dynamic, 3)
+    do i = 1, n
+      x(i) = x(i) * y(9)               ! { dg-warning "is out of bounds" }
+    end do
+    !$omp end do
+    !$omp end parallel
+    !$omp end parallel workshare
+  end do
+end