This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [openacc] implicit non-scalars data mapping in kernels


On Wed, Jan 13, 2016 at 11:35:08PM +0100, Marek Polacek wrote:
> On Wed, Jan 13, 2016 at 02:29:21PM -0800, Cesar Philippidis wrote:
> > --- a/gcc/gimplify.c
> > +++ b/gcc/gimplify.c
> > @@ -5994,6 +5994,11 @@ oacc_default_clause (struct gimplify_omp_ctx *ctx, tree decl, unsigned flags)
> >  {
> >    const char *rkind;
> >    bool on_device = false;
> > +  tree type = TREE_TYPE (decl);
> > +
> > +  if (TREE_CODE (type) == REFERENCE_TYPE
> > +      || POINTER_TYPE_P (type))
> 
> I think this should be just POINTER_TYPE_P--this macro checks for
> REFERENCE_TYPE as well.

Unless the spec says that for all pointers you should consider what it
points to, this really looks weird to me.

Say for OpenMP, I usually use
lang_hooks.decls.omp_privatize_by_reference (decl)
hook for similar purposes where the FEs have the possibility to say
if you are interested in the pointer/reference itself or what it points to,
which is just always false for C, for C++ REFERENCE_TYPE vars and
invisiref stuff, and for Fortran various.
So I'd expect to see instead
  tree type = TREE_TYPE (decl);
  if (lang_hooks.decls.omp_privatize_by_reference (decl))
    type = TREE_TYPE (type);
or so.  Just looking at TREE_TYPE of arbitrary POINTER_TYPE_P has also the
disadvantage that the pointer can be void *, or pointer to incomplete type,
...

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]