Tejas Belagod <tejas.bela...@arm.com> writes: > diff --git a/gcc/config/aarch64/aarch64-sve-builtins.cc > b/gcc/config/aarch64/aarch64-sve-builtins.cc > index e7c703c987e..2c169ea3806 100644 > --- a/gcc/config/aarch64/aarch64-sve-builtins.cc > +++ b/gcc/config/aarch64/aarch64-sve-builtins.cc > @@ -4956,12 +4956,35 @@ handle_arm_sve_vector_bits_attribute (tree *node, > tree, tree args, int, > return NULL_TREE; > } > > + > +/* Return true if OpenMP context types. */ > + > +static bool > +omp_type_context (type_context_kind context) > +{ > + switch (context) > + { > + case TCTX_OMP_MAP: > + case TCTX_OMP_MAP_IMP_REF: > + case TCTX_OMP_PRIVATE: > + case TCTX_OMP_FIRSTPRIVATE: > + case TCTX_OMP_DEVICE_ADDR: > + return true; > + default: > + return false;;
Double semicolon. > + } > +} I think it'd be good to make this an inline function in target.h, since it isn't target-specific. > + > /* Implement TARGET_VERIFY_TYPE_CONTEXT for SVE types. */ > bool > verify_type_context (location_t loc, type_context_kind context, > const_tree type, bool silent_p) > { > - if (!sizeless_type_p (type)) > + const_tree tmp = type; > + if (omp_type_context (context) && POINTER_TYPE_P (type)) > + tmp = strip_pointer_types (tmp); > + > + if (!sizeless_type_p (tmp)) > return true; > > switch (context) > @@ -5021,6 +5044,33 @@ verify_type_context (location_t loc, type_context_kind > context, > if (!silent_p) > error_at (loc, "capture by copy of SVE type %qT", type); > return false; > + > + case TCTX_OMP_MAP: > + if (!silent_p) > + error_at (loc, "SVE type %qT not allowed in map clause", type); > + return false; > + > + case TCTX_OMP_MAP_IMP_REF: > + /* The diagnosis is done in the caller. */ Not sure about this. The documentation says: If defined, this hook returns false if there is a target-specific reason why type @var{type} cannot be used in the source language context described by @var{context}. When @var{silent_p} is false, the hook also reports an error against @var{loc} for invalid uses of @var{type}. So I think we should report an error even for this case, and not report an error in the caller. That unfortunately loses the decl information, but the location would hopefully be enough in practice. On that: > diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc > index 3f602469d57..ace43cf78a0 100644 > --- a/gcc/gimplify.cc > +++ b/gcc/gimplify.cc > @@ -8430,11 +8430,13 @@ omp_notice_variable (struct gimplify_omp_ctx *ctx, > tree decl, bool in_code) > | GOVD_MAP_ALLOC_ONLY)) == flags) > { > tree type = TREE_TYPE (decl); > + location_t dummy = UNKNOWN_LOCATION; > > if (gimplify_omp_ctxp->target_firstprivatize_array_bases > && omp_privatize_by_reference (decl)) > type = TREE_TYPE (type); > - if (!omp_mappable_type (type)) > + if (!omp_mappable_type (type) > + || !verify_type_context (dummy, TCTX_OMP_MAP_IMP_REF, type)) I think we should be passing DECL_SOURCE_LOCATION (decl) here. The target-specific bits look good otherwise. Thanks, Richard