On Wed, Mar 10, 2021 at 11:55:43AM +0100, Tobias Burnus wrote: > --- a/gcc/fortran/trans-openmp.c > +++ b/gcc/fortran/trans-openmp.c > @@ -360,6 +360,39 @@ gfc_has_alloc_comps (tree type, tree decl) > return false; > } > > +/* Return true if TYPE is polymorphic but not with pointer attribute. */ > + > +static bool > +gfc_is_polymorphic_nonptr (tree type) > +{ > + if (POINTER_TYPE_P (type)) > + type = TREE_TYPE (type); > + return GFC_CLASS_TYPE_P (type); > +} > + > +/* Return true if TYPE is unlimited polymorphic but not with pointer > attribute; > + unlimited means also intrinsic types are handled and _len is used. */ > + > +static bool > +gfc_is_unlimited_polymorphic_nonptr (tree type) > +{ > + if (POINTER_TYPE_P (type)) > + type = TREE_TYPE (type); > + if (!GFC_CLASS_TYPE_P (type)) > + return false; > + > + tree field = TYPE_FIELDS (type); /* _data */ > + gcc_assert (field); > + field = DECL_CHAIN (field); /* _vptr */ > + gcc_assert (field); > + field = DECL_CHAIN (field); > + if (!field) > + return false; > + gcc_assert (0 == strcmp ("_len", IDENTIFIER_POINTER (DECL_NAME (field))));
strcmp (...) == 0 instead please. > + return true; > +} > + > + > /* Return true if DECL in private clause needs > OMP_CLAUSE_PRIVATE_OUTER_REF on the private clause. */ > bool > @@ -743,12 +776,88 @@ tree > gfc_omp_clause_copy_ctor (tree clause, tree dest, tree src) > { > tree type = TREE_TYPE (dest), ptr, size, call; > + tree decl_type = TREE_TYPE (OMP_CLAUSE_DECL (clause)); > tree cond, then_b, else_b; > stmtblock_t block, cond_block; > > gcc_assert (OMP_CLAUSE_CODE (clause) == OMP_CLAUSE_FIRSTPRIVATE > || OMP_CLAUSE_CODE (clause) == OMP_CLAUSE_LINEAR); > > + if (DECL_ARTIFICIAL (OMP_CLAUSE_DECL (clause)) > + && DECL_LANG_SPECIFIC (OMP_CLAUSE_DECL (clause)) > + && GFC_DECL_SAVED_DESCRIPTOR (OMP_CLAUSE_DECL (clause))) > + decl_type > + = TREE_TYPE (GFC_DECL_SAVED_DESCRIPTOR (OMP_CLAUSE_DECL (clause))); Indentation, decl_type is indented by 4 spaces, but this line by tab (== 8 sp). Otherwise LGTM, sorry for the delay. Jakub