diff options
author | Tobias Burnus <tobias@codesourcery.com> | 2022-11-03 15:03:52 +0100 |
---|---|---|
committer | Tobias Burnus <tobias@codesourcery.com> | 2022-11-03 15:03:52 +0100 |
commit | 6629444170f85e9b1e243aa07e3e07a8b9f8fce5 (patch) | |
tree | 13b8a330cb79ab4a8a7c4d504c3b2218fad9b1e2 /gcc/fortran | |
parent | 553b1d3dd5b9253ebdf66ee3260c717d5b807dd1 (diff) | |
download | gcc-6629444170f85e9b1e243aa07e3e07a8b9f8fce5.zip gcc-6629444170f85e9b1e243aa07e3e07a8b9f8fce5.tar.gz gcc-6629444170f85e9b1e243aa07e3e07a8b9f8fce5.tar.bz2 |
OpenMP/Fortran: 'target update' with DT components
OpenMP 5.0 permits to use arrays with derived type components for the list
items to the 'from'/'to' clauses of the 'target update' directive.
gcc/fortran/ChangeLog:
* openmp.cc (gfc_match_omp_clauses): Permit derived types for
the 'to' and 'from' clauses of 'target update'.
* trans-openmp.cc (gfc_trans_omp_clauses): Fixes for
derived-type changes; fix size for scalars.
libgomp/ChangeLog:
* testsuite/libgomp.fortran/target-11.f90: New test.
* testsuite/libgomp.fortran/target-13.f90: New test.
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/openmp.cc | 10 | ||||
-rw-r--r-- | gcc/fortran/trans-openmp.cc | 9 |
2 files changed, 12 insertions, 7 deletions
diff --git a/gcc/fortran/openmp.cc b/gcc/fortran/openmp.cc index 653c43f..e0e3b52 100644 --- a/gcc/fortran/openmp.cc +++ b/gcc/fortran/openmp.cc @@ -2499,9 +2499,10 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const omp_mask mask, true) == MATCH_YES) continue; if ((mask & OMP_CLAUSE_FROM) - && gfc_match_omp_variable_list ("from (", + && (gfc_match_omp_variable_list ("from (", &c->lists[OMP_LIST_FROM], false, - NULL, &head, true) == MATCH_YES) + NULL, &head, true, true) + == MATCH_YES)) continue; break; case 'g': @@ -3436,9 +3437,10 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const omp_mask mask, continue; } else if ((mask & OMP_CLAUSE_TO) - && gfc_match_omp_variable_list ("to (", + && (gfc_match_omp_variable_list ("to (", &c->lists[OMP_LIST_TO], false, - NULL, &head, true) == MATCH_YES) + NULL, &head, true, true) + == MATCH_YES)) continue; break; case 'u': diff --git a/gcc/fortran/trans-openmp.cc b/gcc/fortran/trans-openmp.cc index 9bd4e6c..4bfdf85 100644 --- a/gcc/fortran/trans-openmp.cc +++ b/gcc/fortran/trans-openmp.cc @@ -3626,7 +3626,10 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses, gcc_unreachable (); } tree node = build_omp_clause (input_location, clause_code); - if (n->expr == NULL || n->expr->ref->u.ar.type == AR_FULL) + if (n->expr == NULL + || (n->expr->ref->type == REF_ARRAY + && n->expr->ref->u.ar.type == AR_FULL + && n->expr->ref->next == NULL)) { tree decl = gfc_trans_omp_variable (n->sym, false); if (gfc_omp_privatize_by_reference (decl)) @@ -3666,13 +3669,13 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses, { tree ptr; gfc_init_se (&se, NULL); - if (n->expr->ref->u.ar.type == AR_ELEMENT) + if (n->expr->rank == 0) { gfc_conv_expr_reference (&se, n->expr); ptr = se.expr; gfc_add_block_to_block (block, &se.pre); OMP_CLAUSE_SIZE (node) - = TYPE_SIZE_UNIT (TREE_TYPE (ptr)); + = TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (ptr))); } else { |