On Mon, Sep 14, 2020 at 09:50:08AM +0200, Tobias Burnus wrote: > --- a/gcc/fortran/trans-openmp.c > +++ b/gcc/fortran/trans-openmp.c > @@ -1357,6 +1357,15 @@ gfc_omp_finish_clause (tree c, gimple_seq *pre_p) > tree type = TREE_TYPE (decl); > tree ptr = gfc_conv_descriptor_data_get (decl); > > + /* OpenMP: automatically map pointer targets with the pointer; > + hence, always update the descriptor/pointer itself. > + NOTE: This also remaps the pointer for allocatable arrays with > + 'target' attribute which also don't have the 'restrict' qualifier. */ > + bool always_modifier = false; > + > + if (flag_openmp && !(TYPE_QUALS (TREE_TYPE (ptr)) & > TYPE_QUAL_RESTRICT)) > + always_modifier = true;
I think we don't want to depend on flag_openmp here, because one can compile with -fopenmp -fopenacc and simply encounter OpenMP or OpenACC code or none of that (or both as long as we don't reject it due to invalid mixing). So, if we need to handle the two languages differently, we probably need to change the langhook's arguments and pass from the gimplifier a flag whether it is OpenMP or OpenACC construct (or tree code of the construct or whatever else). Guess for now an openacc flag with (ctx->region_type & ORT_ACC) != 0 passed to it seems easiest. > diff --git a/libgomp/target.c b/libgomp/target.c > index 3e292eb..f037151 100644 > --- a/libgomp/target.c > +++ b/libgomp/target.c > @@ -1,3 +1,4 @@ > +#pragma GCC optimize("O0") > /* Copyright (C) 2013-2020 Free Software Foundation, Inc. > Contributed by Jakub Jelinek <ja...@redhat.com>. > Not this change please ;). > @@ -472,8 +474,8 @@ gomp_map_fields_existing (struct target_mem_desc *tgt, > && n2->host_start - n->host_start > == n2->tgt_offset - n->tgt_offset) > { > - gomp_map_vars_existing (devicep, aq, n2, &cur_node, > - &tgt->list[i], kind & typemask, cbuf); > + gomp_map_vars_existing (devicep, aq, n2, &cur_node, &tgt->list[i], > + kind & typemask,false, cbuf); Formatting (move 1 space before false from after it). Jakub