On Tue, Aug 02, 2016 at 09:16:00PM -0700, Cesar Philippidis wrote: > 2016-08-02 Cesar Philippidis <ce...@codesourcery.com> > > gcc/fortran/ > * openmp.c (resolve_oacc_data_clauses): Emit a warning about a > potentially non-contiguous array pointer. > (resolve_omp_clauses): Extend coverage of OpenACC data clause > validation. > * trans-openmp.c (gfc_omp_privatize_by_reference): Use the > TREE_VISITED bit on decl to determine if decl is used inside an > OpenACC region. If so, emit a warning whenever decl is an array > pointer. > > gcc/ > * gimplify.c (oacc_default_clause): Use TREE_VISITED to denote that > decl is used inside an OpenACC region. > > gcc/testsuite/ > * gfortran.dg/goacc/contiguous.f90: New test. > * gfortran.dg/goacc/kernels-alias-4.f95: > > diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c > index e463df7..f3ea9d8 100644 > --- a/gcc/fortran/openmp.c > +++ b/gcc/fortran/openmp.c > @@ -3268,6 +3268,10 @@ resolve_oacc_data_clauses (gfc_symbol *sym, locus loc, > const char *name) > && CLASS_DATA (sym)->attr.allocatable)) > gfc_error ("ALLOCATABLE object %qs of polymorphic type " > "in %s clause at %L", sym->name, name, &loc); > + if (sym->as && sym->as->type == AS_DEFERRED && sym->attr.pointer > + && !sym->attr.contiguous) > + gfc_warning (0, "Potentially noncontiguous deferred shape array %qs in > %s " > + "clause at %L", sym->name, name, &loc); > check_symbol_not_pointer (sym, loc, name); > check_array_not_assumed (sym, loc, name); > }
That doesn't make sense. >From what I can see, the OpenACC 2.0 standard refers to Fortran 2003, which doesn't have CONTIGUOUS attribute. That attribute has been only introduced in Fortran 2008, IMNSHO you can't force OpenACC users even through such warnings (which can't be disabled except for -w even) to use newer Fortran standard in their sources. I'm pretty sure the standard requires something similar to OpenMP, i.e. that the array sections are contiguous. The attribute just asserts something is contiguous, it doesn't mean if the attribute is missing, it isn't contiguous. So, IMNSHO if you want to warn about something, only warn when you provably detect at compile time a non-contiguous array section. Jakub