public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/omp/gcc-10] OpenMP/Fortran: Permit impure ELEMENTAL in omp directives
@ 2020-09-16 14:50 Tobias Burnus
  0 siblings, 0 replies; only message in thread
From: Tobias Burnus @ 2020-09-16 14:50 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:3a6cb32b2c7f5a5ec0de869ab1da9b12b036ca56

commit 3a6cb32b2c7f5a5ec0de869ab1da9b12b036ca56
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Wed Sep 16 16:13:15 2020 +0200

    OpenMP/Fortran: Permit impure ELEMENTAL in omp directives
    
    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.
    
    (cherry picked from commit 244ed2adaa3d349d381ca6ce090c2fa69b6e8d8b)

Diff:
---
 gcc/fortran/ChangeLog.omp                       |  8 ++++++++
 gcc/fortran/parse.c                             |  3 +--
 gcc/testsuite/ChangeLog.omp                     |  7 +++++++
 gcc/testsuite/gfortran.dg/gomp/pr79154-simd.f90 | 16 ++++++++++++++++
 4 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/gcc/fortran/ChangeLog.omp b/gcc/fortran/ChangeLog.omp
index c547f71a054..9e6e8642596 100644
--- a/gcc/fortran/ChangeLog.omp
+++ b/gcc/fortran/ChangeLog.omp
@@ -1,3 +1,11 @@
+2020-09-16  Tobias Burnus  <tobias@codesourcery.com>
+
+	Backport from mainline
+	2020-06-16  Tobias Burnus  <tobias@codesourcery.com>
+
+	* parse.c (decode_omp_directive): Remove "or ELEMENTAL"
+	from "in PURE" error message also for -fopenmp-simd.
+
 2020-09-15  Tobias Burnus  <tobias@codesourcery.com>
 
 	Backport from mainline
diff --git a/gcc/fortran/parse.c b/gcc/fortran/parse.c
index 4b6eb193826..bade7953acd 100644
--- a/gcc/fortran/parse.c
+++ b/gcc/fortran/parse.c
@@ -1083,8 +1083,7 @@ decode_omp_directive (void)
       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;
diff --git a/gcc/testsuite/ChangeLog.omp b/gcc/testsuite/ChangeLog.omp
index 2e64d2c92aa..51185bad155 100644
--- a/gcc/testsuite/ChangeLog.omp
+++ b/gcc/testsuite/ChangeLog.omp
@@ -1,3 +1,10 @@
+2020-09-16  Tobias Burnus  <tobias@codesourcery.com>
+
+	Backport from mainline
+	2020-06-16  Tobias Burnus  <tobias@codesourcery.com>
+
+	* gfortran.dg/gomp/pr79154-simd.f90: New test.
+
 2020-09-11  Tobias Burnus  <tobias@codesourcery.com>
 
 	Backport from mainline
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr79154-simd.f90 b/gcc/testsuite/gfortran.dg/gomp/pr79154-simd.f90
new file mode 100644
index 00000000000..d6b72d6f3da
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/pr79154-simd.f90
@@ -0,0 +1,16 @@
+! { 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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-09-16 14:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-16 14:50 [gcc/devel/omp/gcc-10] OpenMP/Fortran: Permit impure ELEMENTAL in omp directives Tobias Burnus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).