From patchwork Wed Sep 8 17:19:43 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [committed] Fix regression introduced in r163798 (PR fortran/45597) Date: Wed, 08 Sep 2010 07:19:43 -0000 From: Jakub Jelinek X-Patchwork-Id: 64184 Message-Id: <20100908171943.GO1269@tyan-ft48-01.lab.bos.redhat.com> To: gcc-patches@gcc.gnu.org Cc: fortran@gcc.gnu.org Hi! http://gcc.gnu.org/viewcvs?view=revision&revision=163798 change updated trans-stmt.c setup of cycle_label/exit_label, but hasn't adjusted similar setup in trans-openmp.c. Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk. 2010-09-08 Jakub Jelinek PR fortran/45597 * trans-openmp.c (gfc_trans_omp_do): Store exit/cycle labels on code instead of code->block. * gfortran.dg/gomp/pr45597.f90: New test. Jakub --- gcc/fortran/trans-openmp.c.jj 2010-09-06 08:41:42.000000000 +0200 +++ gcc/fortran/trans-openmp.c 2010-09-08 16:14:28.000000000 +0200 @@ -1386,8 +1386,8 @@ gfc_trans_omp_do (gfc_code *code, stmtbl /* 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); --- gcc/testsuite/gfortran.dg/gomp/pr45597.f90.jj 2010-09-08 16:21:33.000000000 +0200 +++ gcc/testsuite/gfortran.dg/gomp/pr45597.f90 2010-09-08 16:21:02.000000000 +0200 @@ -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