Hi Julian,

@Jakub: I suggest to enable it also for OpenMP as prep work. Any objections/comments? @Thomas: This all assumes that "copy(a,a.comp)" is not valid in OpenACC; does this match your understanding of the spec?

On 1/4/20 3:25 AM, Julian Brown wrote:

In C/C++, it's not permitted to mix full struct-type accesses and
"attach/detach" accesses to the same struct's members within a single
directive.  This patch adds the same restriction to the Fortran front-end,
and adjusts some existing tests to match.  A test is also added for
detection of duplicate derived-type member accesses within a directive.

Tested with offloading to NVPTX. OK for mainline?
Looks good do me, with the comments below addressed.
-     the old symbol. gfc_new is used in symbol.c to flag new symbols.  */
+     the old symbol. gfc_new is used in symbol.c to flag new symbols.
+     comp_mark is used to indicate variables which have component accesses
+     in OpenACC directive clauses.  */
"OpenMP/OpenACC" – assuming …
+         /* Allow multiple components of the same (e.g. derived-type)
+            variable here.  Duplicate components are detected elsewhere.  */
          if (openacc && n->expr && n->expr->expr_type == EXPR_VARIABLE)
+             if (ref->type == REF_COMPONENT)
+               component_ref_p = true;
+         if (openacc && ((!component_ref_p && n->sym->comp_mark)
+                         || (component_ref_p && n->sym->mark)))
+           gfc_error ("Symbol %qs has mixed component and non-component "
+                      "accesses at %L", n->sym->name, &n->where);

To match C/C++, I think it makes sense to apply the same check also for OpenMP.

Currently, that's only a nop as the OpenMP 4.5 feature is not yet implemented (and, hence, component access is rejected during parsing) but the condition also applies to OpenMP.

Thanks,

Tobias

Reply via email to