OpenMP/Fortran: Fix EXIT in loop diagnostic [PR105242]

gcc/fortran/ChangeLog:

	PR fortran/105242
	* match.cc (match_exit_cycle): Handle missing OMP LOOP, DO and SIMD
	directives in the EXIT/CYCLE diagnostic.

gcc/testsuite/ChangeLog:

	PR fortran/105242
	* gfortran.dg/gomp/loop-exit.f90: New test.
This commit is contained in:
Tobias Burnus 2022-04-13 18:40:52 +02:00
parent ec03862f80
commit 469fad0161
2 changed files with 769 additions and 71 deletions

View File

@ -2857,83 +2857,107 @@ match_exit_cycle (gfc_statement st, gfc_exec_op op)
for (o = p, cnt = 0; o->state == COMP_DO && o->previous != NULL; cnt++)
o = o->previous;
int count = 1;
if (cnt > 0
&& o != NULL
&& o->state == COMP_OMP_STRUCTURED_BLOCK
&& (o->head->op == EXEC_OACC_LOOP
|| o->head->op == EXEC_OACC_KERNELS_LOOP
|| o->head->op == EXEC_OACC_PARALLEL_LOOP
|| o->head->op == EXEC_OACC_SERIAL_LOOP))
{
int collapse = 1;
gcc_assert (o->head->next != NULL
&& o->state == COMP_OMP_STRUCTURED_BLOCK)
switch (o->head->op)
{
case EXEC_OACC_LOOP:
case EXEC_OACC_KERNELS_LOOP:
case EXEC_OACC_PARALLEL_LOOP:
case EXEC_OACC_SERIAL_LOOP:
gcc_assert (o->head->next != NULL
&& (o->head->next->op == EXEC_DO
|| o->head->next->op == EXEC_DO_WHILE)
&& o->previous != NULL
&& o->previous->tail->op == o->head->op);
if (o->previous->tail->ext.omp_clauses != NULL)
{
/* Both collapsed and tiled loops are lowered the same way, but are
not compatible. In gfc_trans_omp_do, the tile is prioritized. */
if (o->previous->tail->ext.omp_clauses->tile_list)
{
count = 0;
gfc_expr_list *el
= o->previous->tail->ext.omp_clauses->tile_list;
for ( ; el; el = el->next)
++count;
}
else if (o->previous->tail->ext.omp_clauses->collapse > 1)
count = o->previous->tail->ext.omp_clauses->collapse;
}
if (st == ST_EXIT && cnt <= count)
{
gfc_error ("EXIT statement at %C terminating !$ACC LOOP loop");
return MATCH_ERROR;
}
if (st == ST_CYCLE && cnt < count)
{
gfc_error (o->previous->tail->ext.omp_clauses->tile_list
? G_("CYCLE statement at %C to non-innermost tiled "
"!$ACC LOOP loop")
: G_("CYCLE statement at %C to non-innermost collapsed "
"!$ACC LOOP loop"));
return MATCH_ERROR;
}
break;
case EXEC_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD:
case EXEC_OMP_TARGET_PARALLEL_DO_SIMD:
case EXEC_OMP_TARGET_SIMD:
case EXEC_OMP_TASKLOOP_SIMD:
case EXEC_OMP_PARALLEL_MASTER_TASKLOOP_SIMD:
case EXEC_OMP_MASTER_TASKLOOP_SIMD:
case EXEC_OMP_PARALLEL_MASKED_TASKLOOP_SIMD:
case EXEC_OMP_MASKED_TASKLOOP_SIMD:
case EXEC_OMP_PARALLEL_DO_SIMD:
case EXEC_OMP_DISTRIBUTE_SIMD:
case EXEC_OMP_DISTRIBUTE_PARALLEL_DO_SIMD:
case EXEC_OMP_TEAMS_DISTRIBUTE_SIMD:
case EXEC_OMP_TARGET_TEAMS_DISTRIBUTE_SIMD:
case EXEC_OMP_LOOP:
case EXEC_OMP_PARALLEL_LOOP:
case EXEC_OMP_TEAMS_LOOP:
case EXEC_OMP_TARGET_PARALLEL_LOOP:
case EXEC_OMP_TARGET_TEAMS_LOOP:
case EXEC_OMP_DO:
case EXEC_OMP_PARALLEL_DO:
case EXEC_OMP_SIMD:
case EXEC_OMP_DO_SIMD:
case EXEC_OMP_DISTRIBUTE_PARALLEL_DO:
case EXEC_OMP_TEAMS_DISTRIBUTE_PARALLEL_DO:
case EXEC_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO:
case EXEC_OMP_TARGET_PARALLEL_DO:
case EXEC_OMP_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD:
gcc_assert (o->head->next != NULL
&& (o->head->next->op == EXEC_DO
|| o->head->next->op == EXEC_DO_WHILE)
&& o->previous != NULL
&& o->previous->tail->op == o->head->op);
if (o->previous->tail->ext.omp_clauses != NULL)
{
/* Both collapsed and tiled loops are lowered the same way, but are not
compatible. In gfc_trans_omp_do, the tile is prioritized. */
if (o->previous->tail->ext.omp_clauses->tile_list)
{
collapse = 0;
gfc_expr_list *el = o->previous->tail->ext.omp_clauses->tile_list;
for ( ; el; el = el->next)
++collapse;
}
else if (o->previous->tail->ext.omp_clauses->collapse > 1)
collapse = o->previous->tail->ext.omp_clauses->collapse;
}
if (st == ST_EXIT && cnt <= collapse)
{
gfc_error ("EXIT statement at %C terminating !$ACC LOOP loop");
return MATCH_ERROR;
}
if (st == ST_CYCLE && cnt < collapse)
{
gfc_error (o->previous->tail->ext.omp_clauses->tile_list
? G_("CYCLE statement at %C to non-innermost tiled"
" !$ACC LOOP loop")
: G_("CYCLE statement at %C to non-innermost collapsed"
" !$ACC LOOP loop"));
return MATCH_ERROR;
}
}
if (cnt > 0
&& o != NULL
&& (o->state == COMP_OMP_STRUCTURED_BLOCK)
&& (o->head->op == EXEC_OMP_DO
|| o->head->op == EXEC_OMP_PARALLEL_DO
|| o->head->op == EXEC_OMP_SIMD
|| o->head->op == EXEC_OMP_DO_SIMD
|| o->head->op == EXEC_OMP_PARALLEL_DO_SIMD))
{
int count = 1;
gcc_assert (o->head->next != NULL
&& (o->head->next->op == EXEC_DO
|| o->head->next->op == EXEC_DO_WHILE)
&& o->previous != NULL
&& o->previous->tail->op == o->head->op);
if (o->previous->tail->ext.omp_clauses != NULL)
{
if (o->previous->tail->ext.omp_clauses->collapse > 1)
count = o->previous->tail->ext.omp_clauses->collapse;
if (o->previous->tail->ext.omp_clauses->orderedc)
count = o->previous->tail->ext.omp_clauses->orderedc;
}
if (st == ST_EXIT && cnt <= count)
{
gfc_error ("EXIT statement at %C terminating !$OMP DO loop");
return MATCH_ERROR;
}
if (st == ST_CYCLE && cnt < count)
{
gfc_error ("CYCLE statement at %C to non-innermost collapsed"
" !$OMP DO loop");
return MATCH_ERROR;
}
}
if (o->previous->tail->ext.omp_clauses != NULL)
{
if (o->previous->tail->ext.omp_clauses->collapse > 1)
count = o->previous->tail->ext.omp_clauses->collapse;
if (o->previous->tail->ext.omp_clauses->orderedc)
count = o->previous->tail->ext.omp_clauses->orderedc;
}
if (st == ST_EXIT && cnt <= count)
{
gfc_error ("EXIT statement at %C terminating !$OMP DO loop");
return MATCH_ERROR;
}
if (st == ST_CYCLE && cnt < count)
{
gfc_error ("CYCLE statement at %C to non-innermost collapsed "
"!$OMP DO loop");
return MATCH_ERROR;
}
break;
default:
break;
}
/* Save the first statement in the construct - needed by the backend. */
new_st.ext.which_construct = p->construct;

View File

@ -0,0 +1,674 @@
subroutine sub1
!$omp do
outer: do i = 1, 5
inner: do j = 1, 5
if (k == 5) exit ! ok
if (k == 7) exit inner ! ok
if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do inner
end do outer
end
subroutine sub2
!$omp parallel do
outer: do i = 1, 5
inner: do j = 1, 5
if (k == 5) exit ! ok
if (k == 7) exit inner ! ok
if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do inner
end do outer
end
subroutine sub3
!$omp simd
outer: do i = 1, 5
inner: do j = 1, 5
if (k == 5) exit ! ok
if (k == 7) exit inner ! ok
if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do inner
end do outer
end
subroutine sub4
!$omp do simd
outer: do i = 1, 5
inner: do j = 1, 5
if (k == 5) exit ! ok
if (k == 7) exit inner ! ok
if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do inner
end do outer
end
subroutine sub5
!$omp parallel do simd
outer: do i = 1, 5
inner: do j = 1, 5
if (k == 5) exit ! ok
if (k == 7) exit inner ! ok
if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do inner
end do outer
end
subroutine sub6
!$omp distribute simd
outer: do i = 1, 5
inner: do j = 1, 5
if (k == 5) exit ! ok
if (k == 7) exit inner ! ok
if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do inner
end do outer
end
subroutine sub7
!$omp distribute parallel do
outer: do i = 1, 5
inner: do j = 1, 5
if (k == 5) exit ! ok
if (k == 7) exit inner ! ok
if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do inner
end do outer
end
subroutine sub8
!$omp distribute parallel do simd
outer: do i = 1, 5
inner: do j = 1, 5
if (k == 5) exit ! ok
if (k == 7) exit inner ! ok
if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do inner
end do outer
end
subroutine sub9
!$omp teams distribute simd
outer: do i = 1, 5
inner: do j = 1, 5
if (k == 5) exit ! ok
if (k == 7) exit inner ! ok
if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do inner
end do outer
end
subroutine sub10
!$omp target teams distribute simd
outer: do i = 1, 5
inner: do j = 1, 5
if (k == 5) exit ! ok
if (k == 7) exit inner ! ok
if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do inner
end do outer
end
subroutine sub11
!$omp teams distribute parallel do
outer: do i = 1, 5
inner: do j = 1, 5
if (k == 5) exit ! ok
if (k == 7) exit inner ! ok
if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do inner
end do outer
end
subroutine sub12
!$omp target teams distribute parallel do
outer: do i = 1, 5
inner: do j = 1, 5
if (k == 5) exit ! ok
if (k == 7) exit inner ! ok
if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do inner
end do outer
end
subroutine sub13
!$omp teams distribute parallel do simd
outer: do i = 1, 5
inner: do j = 1, 5
if (k == 5) exit ! ok
if (k == 7) exit inner ! ok
if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do inner
end do outer
end
subroutine sub14
!$omp target teams distribute parallel do simd
outer: do i = 1, 5
inner: do j = 1, 5
if (k == 5) exit ! ok
if (k == 7) exit inner ! ok
if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do inner
end do outer
end
subroutine sub15
!$omp target parallel do
outer: do i = 1, 5
inner: do j = 1, 5
if (k == 5) exit ! ok
if (k == 7) exit inner ! ok
if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do inner
end do outer
end
subroutine sub16
!$omp target parallel do simd
outer: do i = 1, 5
inner: do j = 1, 5
if (k == 5) exit ! ok
if (k == 7) exit inner ! ok
if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do inner
end do outer
end
subroutine sub17
!$omp target simd
outer: do i = 1, 5
inner: do j = 1, 5
if (k == 5) exit ! ok
if (k == 7) exit inner ! ok
if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do inner
end do outer
end
subroutine sub18
!$omp taskloop simd
outer: do i = 1, 5
inner: do j = 1, 5
if (k == 5) exit ! ok
if (k == 7) exit inner ! ok
if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do inner
end do outer
end
subroutine sub19
!$omp parallel master taskloop simd
outer: do i = 1, 5
inner: do j = 1, 5
if (k == 5) exit ! ok
if (k == 7) exit inner ! ok
if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do inner
end do outer
end
subroutine sub20
!$omp master taskloop simd
outer: do i = 1, 5
inner: do j = 1, 5
if (k == 5) exit ! ok
if (k == 7) exit inner ! ok
if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do inner
end do outer
end
subroutine sub21
!$omp parallel masked taskloop simd
outer: do i = 1, 5
inner: do j = 1, 5
if (k == 5) exit ! ok
if (k == 7) exit inner ! ok
if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do inner
end do outer
end
subroutine sub22
!$omp masked taskloop simd
outer: do i = 1, 5
inner: do j = 1, 5
if (k == 5) exit ! ok
if (k == 7) exit inner ! ok
if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do inner
end do outer
end
subroutine sub23
!$omp loop
outer: do i = 1, 5
inner: do j = 1, 5
if (k == 5) exit ! ok
if (k == 7) exit inner ! ok
if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do inner
end do outer
end
subroutine sub24
!$omp parallel loop
outer: do i = 1, 5
inner: do j = 1, 5
if (k == 5) exit ! ok
if (k == 7) exit inner ! ok
if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do inner
end do outer
end
subroutine sub25
!$omp teams loop
outer: do i = 1, 5
inner: do j = 1, 5
if (k == 5) exit ! ok
if (k == 7) exit inner ! ok
if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do inner
end do outer
end
subroutine sub26
!$omp target parallel loop
outer: do i = 1, 5
inner: do j = 1, 5
if (k == 5) exit ! ok
if (k == 7) exit inner ! ok
if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do inner
end do outer
end
subroutine sub27
!$omp target teams loop
outer: do i = 1, 5
inner: do j = 1, 5
if (k == 5) exit ! ok
if (k == 7) exit inner ! ok
if (k == 9) exit outer ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do inner
end do outer
end
subroutine sub28
!$omp do collapse(3)
do ii = i1, i2
do jj = j1, j2
do kk = k1, k2
if (kk > 5) then
k = 0
end if
if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do
end do
end do
end
subroutine sub29
!$omp parallel do collapse(3)
do ii = i1, i2
do jj = j1, j2
do kk = k1, k2
if (kk > 5) then
k = 0
end if
if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do
end do
end do
end
subroutine sub30
!$omp simd collapse(3)
do ii = i1, i2
do jj = j1, j2
do kk = k1, k2
if (kk > 5) then
k = 0
end if
if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do
end do
end do
end
subroutine sub31
!$omp do simd collapse(3)
do ii = i1, i2
do jj = j1, j2
do kk = k1, k2
if (kk > 5) then
k = 0
end if
if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do
end do
end do
end
subroutine sub32
!$omp parallel do simd collapse(3)
do ii = i1, i2
do jj = j1, j2
do kk = k1, k2
if (kk > 5) then
k = 0
end if
if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do
end do
end do
end
subroutine sub33
!$omp distribute simd collapse(3)
do ii = i1, i2
do jj = j1, j2
do kk = k1, k2
if (kk > 5) then
k = 0
end if
if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do
end do
end do
end
subroutine sub34
!$omp distribute parallel do collapse(3)
do ii = i1, i2
do jj = j1, j2
do kk = k1, k2
if (kk > 5) then
k = 0
end if
if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do
end do
end do
end
subroutine sub35
!$omp distribute parallel do simd collapse(3)
do ii = i1, i2
do jj = j1, j2
do kk = k1, k2
if (kk > 5) then
k = 0
end if
if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do
end do
end do
end
subroutine sub36
!$omp teams distribute simd collapse(3)
do ii = i1, i2
do jj = j1, j2
do kk = k1, k2
if (kk > 5) then
k = 0
end if
if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do
end do
end do
end
subroutine sub37
!$omp target teams distribute simd collapse(3)
do ii = i1, i2
do jj = j1, j2
do kk = k1, k2
if (kk > 5) then
k = 0
end if
if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do
end do
end do
end
subroutine sub38
!$omp teams distribute parallel do collapse(3)
do ii = i1, i2
do jj = j1, j2
do kk = k1, k2
if (kk > 5) then
k = 0
end if
if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do
end do
end do
end
subroutine sub39
!$omp target teams distribute parallel do collapse(3)
do ii = i1, i2
do jj = j1, j2
do kk = k1, k2
if (kk > 5) then
k = 0
end if
if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do
end do
end do
end
subroutine sub40
!$omp teams distribute parallel do simd collapse(3)
do ii = i1, i2
do jj = j1, j2
do kk = k1, k2
if (kk > 5) then
k = 0
end if
if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do
end do
end do
end
subroutine sub41
!$omp target teams distribute parallel do simd collapse(3)
do ii = i1, i2
do jj = j1, j2
do kk = k1, k2
if (kk > 5) then
k = 0
end if
if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do
end do
end do
end
subroutine sub42
!$omp target parallel do collapse(3)
do ii = i1, i2
do jj = j1, j2
do kk = k1, k2
if (kk > 5) then
k = 0
end if
if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do
end do
end do
end
subroutine sub43
!$omp target parallel do simd collapse(3)
do ii = i1, i2
do jj = j1, j2
do kk = k1, k2
if (kk > 5) then
k = 0
end if
if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do
end do
end do
end
subroutine sub44
!$omp target simd collapse(3)
do ii = i1, i2
do jj = j1, j2
do kk = k1, k2
if (kk > 5) then
k = 0
end if
if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do
end do
end do
end
subroutine sub45
!$omp taskloop simd collapse(3)
do ii = i1, i2
do jj = j1, j2
do kk = k1, k2
if (kk > 5) then
k = 0
end if
if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do
end do
end do
end
subroutine sub46
!$omp parallel master taskloop simd collapse(3)
do ii = i1, i2
do jj = j1, j2
do kk = k1, k2
if (kk > 5) then
k = 0
end if
if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do
end do
end do
end
subroutine sub47
!$omp master taskloop simd collapse(3)
do ii = i1, i2
do jj = j1, j2
do kk = k1, k2
if (kk > 5) then
k = 0
end if
if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do
end do
end do
end
subroutine sub48
!$omp parallel masked taskloop simd collapse(3)
do ii = i1, i2
do jj = j1, j2
do kk = k1, k2
if (kk > 5) then
k = 0
end if
if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do
end do
end do
end
subroutine sub49
!$omp masked taskloop simd collapse(3)
do ii = i1, i2
do jj = j1, j2
do kk = k1, k2
if (kk > 5) then
k = 0
end if
if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do
end do
end do
end
subroutine sub50
!$omp loop collapse(3)
do ii = i1, i2
do jj = j1, j2
do kk = k1, k2
if (kk > 5) then
k = 0
end if
if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do
end do
end do
end
subroutine sub51
!$omp parallel loop collapse(3)
do ii = i1, i2
do jj = j1, j2
do kk = k1, k2
if (kk > 5) then
k = 0
end if
if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do
end do
end do
end
subroutine sub52
!$omp teams loop collapse(3)
do ii = i1, i2
do jj = j1, j2
do kk = k1, k2
if (kk > 5) then
k = 0
end if
if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do
end do
end do
end
subroutine sub53
!$omp target parallel loop collapse(3)
do ii = i1, i2
do jj = j1, j2
do kk = k1, k2
if (kk > 5) then
k = 0
end if
if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do
end do
end do
end
subroutine sub54
!$omp target teams loop collapse(3)
do ii = i1, i2
do jj = j1, j2
do kk = k1, k2
if (kk > 5) then
k = 0
end if
if (kk == 7) exit ! { dg-error "EXIT statement at .1. terminating !.OMP DO loop" }
end do
end do
end do
end