diff options
author | Tobias Burnus <tobias@codesourcery.com> | 2022-07-05 10:03:25 +0200 |
---|---|---|
committer | Tobias Burnus <tobias@codesourcery.com> | 2022-07-05 10:03:25 +0200 |
commit | fc8e0d126aca313606bf1646a4ead1454909c230 (patch) | |
tree | 3d4cbe93df84826a8ddbfc1a18c83b88b44ed3da /gcc | |
parent | 0ca11d9d7fb02f96809eb79c5f9128a6701a6ff4 (diff) | |
download | gcc-fc8e0d126aca313606bf1646a4ead1454909c230.zip gcc-fc8e0d126aca313606bf1646a4ead1454909c230.tar.gz gcc-fc8e0d126aca313606bf1646a4ead1454909c230.tar.bz2 |
OpenMP/Fortran: Add support for firstprivate and allocate clauses on scope construct
Fortran commit to C/C++/backend commit
r13-862-gf38b20d68fade5a922b9f68c4c3841e653d1b83c
gcc/fortran/ChangeLog:
* openmp.cc (OMP_SCOPE_CLAUSES): Add firstprivate and allocate.
libgomp/ChangeLog:
* libgomp.texi (OpenMP 5.2): Mark scope w/ firstprivate/allocate as Y.
* testsuite/libgomp.fortran/scope-2.f90: New test.
gcc/testsuite/ChangeLog:
* gfortran.dg/gomp/scope-5.f90: New test.
* gfortran.dg/gomp/scope-6.f90: New test.
(cherry picked from commit ff35a75473d28205e52ecbcf9e6b5107b8b5ab90)
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/ChangeLog.omp | 7 | ||||
-rw-r--r-- | gcc/fortran/openmp.cc | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog.omp | 8 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/gomp/scope-5.f90 | 9 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/gomp/scope-6.f90 | 23 |
5 files changed, 49 insertions, 1 deletions
diff --git a/gcc/fortran/ChangeLog.omp b/gcc/fortran/ChangeLog.omp index 24d4f84..730308d 100644 --- a/gcc/fortran/ChangeLog.omp +++ b/gcc/fortran/ChangeLog.omp @@ -1,6 +1,13 @@ 2022-07-05 Tobias Burnus <tobias@codesourcery.com> Backport from mainline: + 2022-06-03 Tobias Burnus <tobias@codesourcery.com> + + * openmp.cc (OMP_SCOPE_CLAUSES): Add firstprivate and allocate. + +2022-07-05 Tobias Burnus <tobias@codesourcery.com> + + Backport from mainline: 2022-05-28 Tobias Burnus <tobias@codesourcery.com> * dump-parse-tree.cc (show_omp_clauses): Handle OMP_LIST_ENTER. diff --git a/gcc/fortran/openmp.cc b/gcc/fortran/openmp.cc index ebc29c6..64529f9 100644 --- a/gcc/fortran/openmp.cc +++ b/gcc/fortran/openmp.cc @@ -4230,7 +4230,8 @@ cleanup: | OMP_CLAUSE_PRIVATE | OMP_CLAUSE_LASTPRIVATE | OMP_CLAUSE_REDUCTION) #define OMP_SCOPE_CLAUSES \ - (omp_mask (OMP_CLAUSE_PRIVATE) | OMP_CLAUSE_REDUCTION) + (omp_mask (OMP_CLAUSE_PRIVATE) |OMP_CLAUSE_FIRSTPRIVATE \ + | OMP_CLAUSE_REDUCTION | OMP_CLAUSE_ALLOCATE) #define OMP_SECTIONS_CLAUSES \ (omp_mask (OMP_CLAUSE_PRIVATE) | OMP_CLAUSE_FIRSTPRIVATE \ | OMP_CLAUSE_LASTPRIVATE | OMP_CLAUSE_REDUCTION | OMP_CLAUSE_ALLOCATE) diff --git a/gcc/testsuite/ChangeLog.omp b/gcc/testsuite/ChangeLog.omp index db614a4..7534b51 100644 --- a/gcc/testsuite/ChangeLog.omp +++ b/gcc/testsuite/ChangeLog.omp @@ -1,6 +1,14 @@ 2022-07-05 Tobias Burnus <tobias@codesourcery.com> Backport from mainline: + 2022-06-03 Tobias Burnus <tobias@codesourcery.com> + + * gfortran.dg/gomp/scope-5.f90: New test. + * gfortran.dg/gomp/scope-6.f90: New test. + +2022-07-05 Tobias Burnus <tobias@codesourcery.com> + + Backport from mainline: 2022-05-31 Jakub Jelinek <jakub@redhat.com> * c-c++-common/gomp/scope-5.c: New test. diff --git a/gcc/testsuite/gfortran.dg/gomp/scope-5.f90 b/gcc/testsuite/gfortran.dg/gomp/scope-5.f90 new file mode 100644 index 0000000..baddae5 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/scope-5.f90 @@ -0,0 +1,9 @@ +! { dg-do compile } + +subroutine foo () + integer f + f = 0; + !$omp scope firstprivate(f) ! { dg-error "firstprivate variable 'f' is private in outer context" } + f = f + 1 + !$omp end scope +end diff --git a/gcc/testsuite/gfortran.dg/gomp/scope-6.f90 b/gcc/testsuite/gfortran.dg/gomp/scope-6.f90 new file mode 100644 index 0000000..9c595b1 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/gomp/scope-6.f90 @@ -0,0 +1,23 @@ +! { dg-additional-options "-fdump-tree-original" } + +module m + use iso_c_binding + !use omp_lib, only: omp_allocator_handle_kind + implicit none + integer, parameter :: omp_allocator_handle_kind = c_intptr_t + integer :: a = 0, b = 42, c = 0 + +contains + subroutine foo (h) + integer(omp_allocator_handle_kind), value :: h + !$omp scope private (a) firstprivate (b) reduction (+: c) allocate ( h : a , b , c) + if (b /= 42) & + error stop + a = 36 + b = 15 + c = c + 1 + !$omp end scope + end +end + +! { dg-final { scan-tree-dump "omp scope private\\(a\\) firstprivate\\(b\\) reduction\\(\\+:c\\) allocate\\(allocator\\(D\\.\[0-9\]+\\):a) allocate\\(allocator\\(D\\.\[0-9\]+\\):b) allocate\\(allocator\\(D\\.\[0-9\]+\\):c)" "original" } } |