]> git.ipfire.org Git - thirdparty/gcc.git/commit
Add support for allocate clause (OpenMP 5.0).
authorHafiz Abid Qadeer <abidh@codesourcery.com>
Fri, 24 Sep 2021 09:04:12 +0000 (10:04 +0100)
committerHafiz Abid Qadeer <abidh@codesourcery.com>
Tue, 8 Mar 2022 19:17:51 +0000 (19:17 +0000)
commit52c37cc67c5c8793e36f8f273c5d7d6e46963c39
treef1bdc4c03e5180cef261c7614946ae554349b1b7
parent117c50428fd9b497480f7eed1d499777de9b7da7
Add support for allocate clause (OpenMP 5.0).

This patch adds support for OpenMP 5.0 allocate clause for fortran. It does not
yet support the allocator-modifier as specified in OpenMP 5.1. The allocate
clause is already supported in C/C++.

This commit contains 4 following upstream commits.

69561fc781a Add support for allocate clause (OpenMP 5.0).
deb9f18f677 Change kind of integer literal to fix a testcase.
6d498135016 libgomp.fortran/allocate-1.f90: Minor cleanup
f62156eab7b libgomp.fortran/allocate-1.f90: Fix minor cleanup

gcc/fortran/ChangeLog:

* dump-parse-tree.c (show_omp_clauses): Handle OMP_LIST_ALLOCATE.
* gfortran.h (OMP_LIST_ALLOCATE): New enum value.
* openmp.c (enum omp_mask1): Add OMP_CLAUSE_ALLOCATE.
(gfc_match_omp_clauses): Handle OMP_CLAUSE_ALLOCATE
(OMP_PARALLEL_CLAUSES, OMP_DO_CLAUSES, OMP_SECTIONS_CLAUSES)
(OMP_TASK_CLAUSES, OMP_TASKLOOP_CLAUSES, OMP_TARGET_CLAUSES)
(OMP_TEAMS_CLAUSES, OMP_DISTRIBUTE_CLAUSES)
(OMP_SINGLE_CLAUSES): Add OMP_CLAUSE_ALLOCATE.
(OMP_TASKGROUP_CLAUSES): New.
(gfc_match_omp_taskgroup): Use OMP_TASKGROUP_CLAUSES instead of
OMP_CLAUSE_TASK_REDUCTION.
(resolve_omp_clauses): Handle OMP_LIST_ALLOCATE.
(resolve_omp_do): Avoid warning when loop iteration variable is
in allocate clause.
* trans-openmp.c (gfc_trans_omp_clauses): Handle translation of
allocate clause.
(gfc_split_omp_clauses): Update for OMP_LIST_ALLOCATE.

gcc/testsuite/ChangeLog:

* gfortran.dg/gomp/allocate-1.f90: New test.
* gfortran.dg/gomp/allocate-2.f90: New test.
* gfortran.dg/gomp/allocate-3.f90: New test.
* gfortran.dg/gomp/collapse1.f90: Update error message.
* gfortran.dg/gomp/openmp-simd-4.f90: Likewise.
* gfortran.dg/gomp/clauses-1.f90: Uncomment allocate clause.

libgomp/ChangeLog:

* testsuite/libgomp.fortran/allocate-1.c: New test.
* testsuite/libgomp.fortran/allocate-1.f90: New test.
* libgomp.texi: Remove string that says that allocate clause
support is for C/C++ only.

(cherry picked from commit 69561fc781aca3dea3aa4d5d562ef5a502965924)

Change kind of integer literal to fix a testcase.

As Thomas reported in
https://gcc.gnu.org/pipermail/gcc-patches/2022-January/588448.html
a test added in my recent allocate clause patch fails on m32. It was due
to default kind for integer matching c_intptr_t for m32. I have now
changed it to 0_1 so that always integer with kind=1 is used.

gcc/testsuite/ChangeLog:

* gfortran.dg/gomp/allocate-2.f90: Change 0 to 0_1.

(cherry picked from commit deb9f18f67788c36f4652bca101d93faf07ecf39)

libgomp.fortran/allocate-1.f90: Minor cleanup

libgomp/ChangeLog:
* testsuite/libgomp.fortran/allocate-1.c (is_64bit_aligned): Renamed
from is_64bit_aligned_.
* testsuite/libgomp.fortran/allocate-1.f90: Fix interface decl
and use it, more implicit none, remove unused argument.

(cherry picked from commit 6d4981350168f1eb3f72149bd7e05b9ba6bec1fd)

libgomp.fortran/allocate-1.f90: Fix minor cleanup

libgomp/ChangeLog:
* testsuite/libgomp.fortran/allocate-1.f90: Remove spurious
STOP of previous commit.

(cherry picked from commit f62156eab7b757d1ee03a11d5c96c72bd3de079c)
16 files changed:
gcc/fortran/ChangeLog.omp
gcc/fortran/dump-parse-tree.c
gcc/fortran/gfortran.h
gcc/fortran/openmp.c
gcc/fortran/trans-openmp.c
gcc/testsuite/ChangeLog.omp
gcc/testsuite/gfortran.dg/gomp/allocate-1.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/allocate-2.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/allocate-3.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/clauses-1.f90
gcc/testsuite/gfortran.dg/gomp/collapse1.f90
gcc/testsuite/gfortran.dg/gomp/openmp-simd-4.f90
libgomp/ChangeLog.omp
libgomp/libgomp.texi
libgomp/testsuite/libgomp.fortran/allocate-1.c [new file with mode: 0644]
libgomp/testsuite/libgomp.fortran/allocate-1.f90 [new file with mode: 0644]