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>
Thu, 13 Jan 2022 18:57:05 +0000 (18:57 +0000)
commit69561fc781aca3dea3aa4d5d562ef5a502965924
tree9b7da04bfacf5d26db78c8b30c07e297ced8d20a
parent49d5fb4feee831868d80fff4d024c271911c92ca
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++.

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.
13 files changed:
gcc/fortran/dump-parse-tree.c
gcc/fortran/gfortran.h
gcc/fortran/openmp.c
gcc/fortran/trans-openmp.c
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/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]