PR fortran/45597
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 8 Sep 2010 16:47:16 +0000 (16:47 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 8 Sep 2010 16:47:16 +0000 (16:47 +0000)
* trans-openmp.c (gfc_trans_omp_do): Store exit/cycle labels on code
instead of code->block.

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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@164005 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/fortran/ChangeLog
gcc/fortran/trans-openmp.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/gomp/pr45597.f90 [new file with mode: 0644]

index 1f38eec..700fe91 100644 (file)
@@ -1,5 +1,9 @@
 2010-09-08  Jakub Jelinek  <jakub@redhat.com>
 
+       PR fortran/45597
+       * trans-openmp.c (gfc_trans_omp_do): Store exit/cycle labels on code
+       instead of code->block.
+
        PR fortran/45595
        * openmp.c (resolve_omp_do): Report not enough do loops for
        collapse even if block->next is NULL.
index d1638b6..9c6da71 100644 (file)
@@ -1386,8 +1386,8 @@ gfc_trans_omp_do (gfc_code *code, stmtblock_t *pblock,
 
   /* Put these labels where they can be found later.  */
 
-  code->block->cycle_label = cycle_label;
-  code->block->exit_label = NULL_TREE;
+  code->cycle_label = cycle_label;
+  code->exit_label = NULL_TREE;
 
   /* Main loop body.  */
   tmp = gfc_trans_omp_code (code->block->next, true);
index 2bf1034..e5c116a 100644 (file)
@@ -1,5 +1,8 @@
 2010-09-08  Jakub Jelinek  <jakub@redhat.com>
 
+       PR fortran/45597
+       * gfortran.dg/gomp/pr45597.f90: New test.
+
        PR fortran/45595
        * gfortran.dg/gomp/pr45595.f90: New test.
 
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr45597.f90 b/gcc/testsuite/gfortran.dg/gomp/pr45597.f90
new file mode 100644 (file)
index 0000000..6d6a65d
--- /dev/null
@@ -0,0 +1,22 @@
+! PR fortran/45597
+! { dg-do compile }
+! { dg-options "-fopenmp" }
+
+subroutine foo(n)
+  integer :: i, n(6)
+  !$omp parallel do default(none) shared(n)
+    do i = 1, 6
+      if (n(i).gt.0) cycle
+    end do
+end subroutine
+subroutine bar(n)
+  integer :: i, j, k, n(6, 6, 6)
+  !$omp parallel do default(none) shared(n) collapse(3)
+    do i = 1, 6
+      do j = 1, 6
+        do k = 1, 6
+          if (n(i, j, k).gt.0) cycle
+        end do
+      end do
+    end do
+end subroutine