https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103276
--- Comment #9 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Namely, something like the following seems to do for OpenMP.
I am pretty sure it is not 100% correct. (At least, it fixes the testcase of
comment 8.)
For some reasons, an (equivalent?) OpenACC testcase does not seem to fail here;
in case case, the testcase below wouldn't be fixed as it required a check for
EXEC_OACC_ENTER_DATA and EXEC_OACC_EXIT_DATA.
Plus: Is this ptr map required for TARGET DATA or can we do without? Other code
affected by similar changes?
--- a/gcc/fortran/trans-openmp.cc
+++ b/gcc/fortran/trans-openmp.cc
@@ -4250,4 +4250,11 @@ gfc_trans_omp_clauses (stmtblock_t *block,
gfc_omp_clauses *clauses,
/* For descriptor types, the unmapping happens below. */
- if (op != EXEC_OMP_TARGET_EXIT_DATA
- || !GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (decl)))
+ if ((op != EXEC_OMP_TARGET_EXIT_DATA
+ && op != EXEC_OMP_TARGET_ENTER_DATA)
+ || (!GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (decl))
+ && (pointer
+ || allocatable
+ || GFC_DECL_CRAY_POINTEE (decl)
+ || (n->sym->ts.type == BT_DERIVED
+ && (n->sym->ts.u.derived->ts.f90_type
+ != BT_VOID)))))
{
@@ -9171,3 +9178,3 @@ gfc_trans_omp_target_enter_data (gfc_code *code)
omp_clauses = gfc_trans_omp_clauses (&block, code->ext.omp_clauses,
- code->loc);
+ code->loc, false, false, code->op);
stmt = build1_loc (input_location, OMP_TARGET_ENTER_DATA, void_type_node,