]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fortran: Support OpenMP's 'allocate' directive for stack vars
authorTobias Burnus <tobias@codesourcery.com>
Thu, 26 Oct 2023 09:52:15 +0000 (11:52 +0200)
committerTobias Burnus <tobias@codesourcery.com>
Thu, 26 Oct 2023 09:52:15 +0000 (11:52 +0200)
commit59175e6f0889ba3be79b04622ce614f0ceb6284a
treea2e2fdec85143151d053b163776a6a5105c0fc07
parent7449921f6a002c4b1835122cd446b68877610ff0
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-5a.f90: Renamed from
testsuite/libgomp.fortran/allocate-5.f90.
* 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.

(cherry picked from commit 969f5c3eaa7f073f532206ced0f177b4eb58aee2)
31 files changed:
gcc/ChangeLog.omp
gcc/fortran/ChangeLog.omp
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/ChangeLog.omp
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/ChangeLog.omp
libgomp/libgomp.texi
libgomp/testsuite/libgomp.fortran/allocate-5.f90
libgomp/testsuite/libgomp.fortran/allocate-5a.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]