https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122306

--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
The following shows an other example of too early optimization
as the 'end metadirective' is rejected. (It works when
the condition is not .false.-evaluating const-expr.)

SUBROUTINE test4(x_min, x_max, vol_flux_x)
  IMPLICIT NONE
  INTEGER, INTENT(IN) :: x_min, x_max
  REAL(KIND=8), DIMENSION(x_min:x_max) :: vol_flux_x
  integer, parameter :: one = 1
  INTEGER :: j

   ! The following program fails if the condition is constant
   ! because in that case, only 'nothing' remains and ...

   !$omp begin metadirective when(user={condition(one < 0)}: parallel)
    DO j=x_min,x_max
      vol_flux_x(j)=0.25_8
    ENDDO
   !$omp end metadirective ! this line now fails with:
   !  Error: Unexpected !$OMP END METADIRECTIVE statement at
END SUBROUTINE test4

Reply via email to