OpenMP since 4.5 permits IMPURE ELEMENTAL in directives and
the code already only checked for PURE. – Followup for
-fopenmp-simd.
gcc/fortran/ChangeLog:
* parse.c (decode_omp_directive): Remove "or ELEMENTAL"
from "in PURE" error message also for -fopenmp-simd.
gcc/testsuite/ChangeLog:
* gfortran.dg/gomp/pr79154-simd.f90: New test.
if (!flag_openmp && gfc_pure (NULL))
{
gfc_error_now ("OpenMP directives other than SIMD or DECLARE TARGET "
- "at %C may not appear in PURE or ELEMENTAL "
- "procedures");
+ "at %C may not appear in PURE procedures");
reject_statement ();
gfc_error_recovery ();
return ST_NONE;
--- /dev/null
+! { dg-options "-fno-openmp -fopenmp-simd" }
+!
+pure subroutine bar(a)
+ integer, intent(in) :: a(:)
+ !$omp target enter data map(to:a) ! Ignored with -fopenmp-simd otherwise invalid in PURE
+end
+
+pure subroutine foo(a,b)
+ integer, intent(out) :: a(5)
+ integer, intent(in) :: b(5)
+ !$omp target teams distribute simd ! { dg-error "may not appear in PURE procedures" }
+ do i=1, 5
+ a(i) = b(i)
+ end do
+ !$omp end target teams distribute
+end subroutine