On Thu, Oct 31, 2019 at 06:09:28PM +0100, Tobias Burnus wrote: > --- a/gcc/fortran/trans-openmp.c > +++ b/gcc/fortran/trans-openmp.c > @@ -71,6 +71,33 @@ gfc_omp_is_optional_argument (const_tree decl) > && GFC_DECL_OPTIONAL_ARGUMENT (decl)); > } > > + > +/* Returns tree with NULL if it is not an array descriptor and with the tree > to > + access the 'data' component otherwise. With type_only = true, it returns > the > + TREE_TYPE without creating a new tree. */ > + > +tree > +gfc_omp_array_data (tree decl, bool type_only) > +{ > + tree type = TREE_TYPE (decl); > + > + if (TREE_CODE (type) == REFERENCE_TYPE || POINTER_TYPE_P (type))
POINTER_TYPE_P is defined as #define POINTER_TYPE_P(TYPE) \ (TREE_CODE (TYPE) == POINTER_TYPE || TREE_CODE (TYPE) == REFERENCE_TYPE) so no need for the "TREE_CODE (type) == REFERENCE_TYPE || " part. > @@ -12048,11 +12070,50 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, > omp_context *ctx) > case OMP_CLAUSE_USE_DEVICE_ADDR: > case OMP_CLAUSE_IS_DEVICE_PTR: > var = OMP_CLAUSE_DECL (c); > + bool is_array_data > + = lang_hooks.decls.omp_array_data (var, true) != NULL; As this is inside of switch body at the switch body scope, I'd say it would be better to: + bool is_array_data; + is_array_data + = lang_hooks.decls.omp_array_data (var, true) != NULL; While it will compile now because there are no labels after it, as soon as somebody adds one, it will fail to compile. Ok for trunk with those nits fixed. Jakub