]> git.ipfire.org Git - thirdparty/gcc.git/commit - gcc/fortran/gfortran.h
Fortran: Support OpenMP's 'allocate' directive for stack vars
authorTobias Burnus <tobias@codesourcery.com>
Sat, 14 Oct 2023 09:07:47 +0000 (11:07 +0200)
committerTobias Burnus <tobias@codesourcery.com>
Sat, 14 Oct 2023 09:07:47 +0000 (11:07 +0200)
commit969f5c3eaa7f073f532206ced0f177b4eb58aee2
treef40553a911038b120691c1e7f92e2f5bd74886a7
parentcb0119242317c2a6f3127b4acff6aadbfd1dfbc4
Fortran: Support OpenMP's 'allocate' directive for stack vars

gcc/fortran/ChangeLog:

* gfortran.h (ext_attr_t): Add omp_allocate flag.
* match.cc (gfc_free_omp_namelist): Void deleting same
u2.allocator multiple times now that a sequence can use
the same one.
* openmp.cc (gfc_match_omp_clauses, gfc_match_omp_allocate): Use
same allocator expr multiple times.
(is_predefined_allocator): Make static.
(gfc_resolve_omp_allocate): Update/extend restriction checks;
remove sorry message.
(resolve_omp_clauses): Reject corarrays in allocate/allocators
directive.
* parse.cc (check_omp_allocate_stmt): Permit procedure pointers
here (rejected later) for less misleading diagnostic.
* trans-array.cc (gfc_trans_auto_array_allocation): Propagate
size for GOMP_alloc and location to which it should be added to.
* trans-decl.cc (gfc_trans_deferred_vars): Handle 'omp allocate'
for stack variables; sorry for static variables/common blocks.
* trans-openmp.cc (gfc_trans_omp_clauses): Evaluate 'allocate'
clause's allocator only once; fix adding expressions to the
block.
(gfc_trans_omp_single): Pass a block to gfc_trans_omp_clauses.

gcc/ChangeLog:

* gimplify.cc (gimplify_bind_expr): Handle Fortran's
'omp allocate' for stack variables.

libgomp/ChangeLog:

* libgomp.texi (OpenMP Impl. Status): Mention that Fortran now
supports the allocate directive for stack variables.
* testsuite/libgomp.fortran/allocate-5.f90: New test.
* testsuite/libgomp.fortran/allocate-6.f90: New test.
* testsuite/libgomp.fortran/allocate-7.f90: New test.
* testsuite/libgomp.fortran/allocate-8.f90: New test.

gcc/testsuite/ChangeLog:

* c-c++-common/gomp/allocate-14.c: Fix directive name.
* c-c++-common/gomp/allocate-15.c: Likewise.
* c-c++-common/gomp/allocate-9.c: Fix comment typo.
* gfortran.dg/gomp/allocate-4.f90: Remove sorry dg-error.
* gfortran.dg/gomp/allocate-7.f90: Likewise.
* gfortran.dg/gomp/allocate-10.f90: New test.
* gfortran.dg/gomp/allocate-11.f90: New test.
* gfortran.dg/gomp/allocate-12.f90: New test.
* gfortran.dg/gomp/allocate-13.f90: New test.
* gfortran.dg/gomp/allocate-14.f90: New test.
* gfortran.dg/gomp/allocate-15.f90: New test.
* gfortran.dg/gomp/allocate-8.f90: New test.
* gfortran.dg/gomp/allocate-9.f90: New test.
26 files changed:
gcc/fortran/gfortran.h
gcc/fortran/match.cc
gcc/fortran/openmp.cc
gcc/fortran/parse.cc
gcc/fortran/trans-array.cc
gcc/fortran/trans-decl.cc
gcc/fortran/trans-openmp.cc
gcc/gimplify.cc
gcc/testsuite/c-c++-common/gomp/allocate-14.c
gcc/testsuite/c-c++-common/gomp/allocate-15.c
gcc/testsuite/c-c++-common/gomp/allocate-9.c
gcc/testsuite/gfortran.dg/gomp/allocate-10.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/allocate-11.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/allocate-12.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/allocate-13.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/allocate-14.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/allocate-15.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/allocate-4.f90
gcc/testsuite/gfortran.dg/gomp/allocate-7.f90
gcc/testsuite/gfortran.dg/gomp/allocate-8.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/gomp/allocate-9.f90 [new file with mode: 0644]
libgomp/libgomp.texi
libgomp/testsuite/libgomp.fortran/allocate-5.f90 [new file with mode: 0644]
libgomp/testsuite/libgomp.fortran/allocate-6.f90 [new file with mode: 0644]
libgomp/testsuite/libgomp.fortran/allocate-7.f90 [new file with mode: 0644]
libgomp/testsuite/libgomp.fortran/allocate-8.f90 [new file with mode: 0644]