]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fortran/OpenMP: Fix mapping of array descriptors and deferred-length strings
authorTobias Burnus <tobias@codesourcery.com>
Wed, 22 Feb 2023 20:18:33 +0000 (21:18 +0100)
committerTobias Burnus <tobias@codesourcery.com>
Wed, 22 Feb 2023 20:18:33 +0000 (21:18 +0100)
commit55a18d4744258e3909568e425f9f473c49f9d13f
tree2c006602b7eca203af361675094fce7b0f5ddfae
parentcbd92239ae10fdc8abc69355fd4397473cdf5950
Fortran/OpenMP: Fix mapping of array descriptors and deferred-length strings

Previously, array descriptors might have been mapped as 'alloc'
instead of 'to' for 'alloc', not updating the array bounds. The
'alloc' could also appear for 'data exit', failing with a libgomp
assert. In some cases, either array descriptors or deferred-length
string's length variable was not mapped. And, finally, some offset
calculations with array-sections mappings went wrong.

The testcases contain some comment-out tests which require follow-up
work and for which PR exist. Those mostly relate to deferred-length
strings which have several issues beyong OpenMP support.

This is the OG12 variant of the submitted but unreviewed GCC 13/mainline
patch at https://gcc.gnu.org/pipermail/gcc-patches/2023-February/612387.html

gcc/fortran/ChangeLog:

* trans-decl.cc (gfc_get_symbol_decl): Add attributes
such as 'declare target' also to hidden artificial
variable for deferred-length character variables.
* trans-openmp.cc (gfc_trans_omp_array_section,
gfc_trans_omp_clauses, gfc_trans_omp_target_exit_data):
Improve mapping of array descriptors and deferred-length
string variables.

gcc/ChangeLog:

* gimplify.cc (gimplify_scan_omp_clauses): Remove Fortran
special case.

libgomp/ChangeLog:

* testsuite/libgomp.fortran/target-enter-data-3.f90: Uncomment
'target exit data'.
* testsuite/libgomp.fortran/target-enter-data-4.f90: New test.
* testsuite/libgomp.fortran/target-enter-data-5.f90: New test.
* testsuite/libgomp.fortran/target-enter-data-6.f90: New test.
* testsuite/libgomp.fortran/target-enter-data-7.f90: New test.
gcc/ChangeLog.omp
gcc/fortran/ChangeLog.omp
gcc/fortran/trans-decl.cc
gcc/fortran/trans-openmp.cc
gcc/gimplify.cc
libgomp/ChangeLog.omp
libgomp/testsuite/libgomp.fortran/target-enter-data-4.f90
libgomp/testsuite/libgomp.fortran/target-enter-data-4a.f90 [new file with mode: 0644]
libgomp/testsuite/libgomp.fortran/target-enter-data-5.f90 [new file with mode: 0644]
libgomp/testsuite/libgomp.fortran/target-enter-data-6.f90 [new file with mode: 0644]
libgomp/testsuite/libgomp.fortran/target-enter-data-7.f90 [new file with mode: 0644]