Trunk (r276698): I have tested it with nvptx, it worked; hence, I moved it to libgomp as run-time test.

OG9: I have also committed the patch to the OG9 / openacc-gcc-9 branch. (54fbada7d4d38e420efb5a10d39e03b02533b1e7)

Thanks,

Tobias

On 10/8/19 2:12 PM, Jakub Jelinek wrote:
On Tue, Oct 08, 2019 at 02:04:17PM +0200, Tobias Burnus wrote:
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.)
gfortran.dg/gomp/ shouldn't contain dg-do link or dg-do run tests,
those should be in libgomp/testsuite/libgomp.fortran/
but then there is no point duplicating the test in gfortran.dg/gomp/.

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

        testsuite/
        * gfortran.dg/gomp/target-simd.f90: New.
Ok, with moving the test to libgomp.fortran/ and removing the dg-do compile
line, or without.

--- /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

        Jakub

Reply via email to