diff options
author | Tobias Burnus <tobias@codesourcery.com> | 2022-11-02 17:04:53 +0100 |
---|---|---|
committer | Tobias Burnus <tobias@codesourcery.com> | 2022-11-02 17:04:53 +0100 |
commit | 9cb4ef1e56c7187e5a4ab0decf947f3b3df7402f (patch) | |
tree | d080faaabcb5f3534f0776679d17ceeecda90123 /gcc | |
parent | ca13348769e83462e7b1166159fee01c89b70589 (diff) | |
download | gcc-9cb4ef1e56c7187e5a4ab0decf947f3b3df7402f.zip gcc-9cb4ef1e56c7187e5a4ab0decf947f3b3df7402f.tar.gz gcc-9cb4ef1e56c7187e5a4ab0decf947f3b3df7402f.tar.bz2 |
Fortran/OpenMP: Fix DT struct-component with 'alloc' and array descr
When using 'map(alloc: var, dt%comp)' needs to have a 'to' mapping of
the array descriptor as otherwise the bounds are not available in the
target region. - Likewise for character strings.
This patch implements this; however, some additional issues are exposed
by the testcase; those are '#if 0'ed and will be handled later.
Submitted to mainline (but pending review):
https://gcc.gnu.org/pipermail/gcc-patches/2022-November/604887.html
gcc/fortran/ChangeLog:
* trans-openmp.cc (gfc_trans_omp_clauses): Ensure DT struct-comp with
array descriptor and 'alloc:' have the descriptor mapped with 'to:'.
libgomp/ChangeLog:
* testsuite/libgomp.fortran/target-enter-data-3.f90: New test.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/ChangeLog.omp | 5 | ||||
-rw-r--r-- | gcc/fortran/trans-openmp.cc | 3 |
2 files changed, 7 insertions, 1 deletions
diff --git a/gcc/fortran/ChangeLog.omp b/gcc/fortran/ChangeLog.omp index 0e06ffb..a7ce52c 100644 --- a/gcc/fortran/ChangeLog.omp +++ b/gcc/fortran/ChangeLog.omp @@ -1,5 +1,10 @@ 2022-11-02 Tobias Burnus <tobias@codesourcery.com> + * trans-openmp.cc (gfc_trans_omp_clauses): Ensure DT struct-comp with + array descriptor and 'alloc:' have the descriptor mapped with 'to:'. + +2022-11-02 Tobias Burnus <tobias@codesourcery.com> + * openmp.cc (gfc_match_omp_clauses): Permit derived types. (resolve_omp_clauses):Accept noncontiguous arrays. diff --git a/gcc/fortran/trans-openmp.cc b/gcc/fortran/trans-openmp.cc index 255c676..892f062 100644 --- a/gcc/fortran/trans-openmp.cc +++ b/gcc/fortran/trans-openmp.cc @@ -4991,7 +4991,8 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses, = gfc_full_array_size (block, inner, rank); tree elemsz = TYPE_SIZE_UNIT (gfc_get_element_type (type)); - if (GOMP_MAP_COPY_TO_P (OMP_CLAUSE_MAP_KIND (node))) + if (GOMP_MAP_COPY_TO_P (OMP_CLAUSE_MAP_KIND (node)) + || OMP_CLAUSE_MAP_KIND (node) == GOMP_MAP_ALLOC) map_kind = GOMP_MAP_TO; else if (n->u.map_op == OMP_MAP_RELEASE || n->u.map_op == OMP_MAP_DELETE) |