From 65b67cf390bc0240a91730e8eb95d7a7b2d8aca0 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Tue, 8 Oct 2019 12:30:44 +0000 Subject: [PATCH] Fortran - fix OpenMP 'target simd' gcc/fortran/ * parse.c (parse_executable): Add missing ST_OMP_TARGET_SIMD. libgomp/ * testsuite/libgomp.fortran/target-simd.f90: New. From-SVN: r276698 --- gcc/fortran/ChangeLog | 4 +++ gcc/fortran/parse.c | 1 + libgomp/ChangeLog | 4 +++ .../testsuite/libgomp.fortran/target-simd.f90 | 26 +++++++++++++++++++ 4 files changed, 35 insertions(+) create mode 100644 libgomp/testsuite/libgomp.fortran/target-simd.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 309d4ef9ff0..b5bef54a297 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,7 @@ +2019-10-08 Tobias Burnus + + * parse.c (parse_executable): Add missing ST_OMP_TARGET_SIMD. + 2019-10-08 Tobias Burnus * match.h (gfc_match_omp_eos_error): Renamed from gfc_match_omp_eos. 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/libgomp/ChangeLog b/libgomp/ChangeLog index 2059e053457..67d5737e5e8 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,7 @@ +2019-10-08 Tobias Burnus + + * gfortran.dg/gomp/target-simd.f90: New. + 2019-10-02 Julian Brown Cesar Philippidis diff --git a/libgomp/testsuite/libgomp.fortran/target-simd.f90 b/libgomp/testsuite/libgomp.fortran/target-simd.f90 new file mode 100644 index 00000000000..d49ae74af8f --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/target-simd.f90 @@ -0,0 +1,26 @@ +! { dg-do run } + +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 -- 2.30.2