Seemingly, 'target simd' was forgotten – which yielded the error:
"Unexpected !$OMP TARGET SIMD statement"

OK for the trunk?

Tobias

PS: The test case should also work as 'dg-do run' test, if it makes more sense. (Only tested on a system w/o offloading, but I would test it with nvptx before committing it.)

	fortran/
	* parse.c (parse_executable): Add missing ST_OMP_TARGET_SIMD.

	testsuite/
	* gfortran.dg/gomp/target-simd.f90: New.

diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c
index 03fc716dbf5..15f6bf2937c 100644
--- a/gcc/fortran/parse.c
+++ b/gcc/fortran/parse.c
@@ -5534,6 +5534,7 @@ parse_executable (gfc_statement st)
 	case ST_OMP_SIMD:
 	case ST_OMP_TARGET_PARALLEL_DO:
 	case ST_OMP_TARGET_PARALLEL_DO_SIMD:
+	case ST_OMP_TARGET_SIMD:
 	case ST_OMP_TARGET_TEAMS_DISTRIBUTE:
 	case ST_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO:
 	case ST_OMP_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD:
diff --git a/gcc/testsuite/gfortran.dg/gomp/target-simd.f90 b/gcc/testsuite/gfortran.dg/gomp/target-simd.f90
new file mode 100644
index 00000000000..733420f4cc7
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/target-simd.f90
@@ -0,0 +1,26 @@
+! { dg-do compile }
+
+program test
+  implicit none
+  real, allocatable :: a(:), b(:)
+  integer :: i
+
+  a = [(i, i = 1, 100)]
+  allocate(b, mold=a)
+  b = 0
+
+  !$omp target simd map(to:a) map(from:b)
+  do i = 0, size(a)
+    b(i) = 5.0 * a(i)
+  end do
+
+  if (any (b - 5.0 *a > 10.0*epsilon(a))) call abort()
+
+  !$omp target simd map(to:a) map(from:b)
+  do i = 0, size(a)
+    b(i) = 2.0 * a(i)
+  end do
+  !$omp end target simd
+
+  if (any (b - 2.0 *a > 10.0*epsilon(a))) call abort()
+end program test

Reply via email to