From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14679 invoked by alias); 9 Aug 2016 15:28:55 -0000 Mailing-List: contact fortran-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: fortran-owner@gcc.gnu.org Received: (qmail 14660 invoked by uid 89); 9 Aug 2016 15:28:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=*sym, sym, UD:gimplify.c, gimplify.c X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 09 Aug 2016 15:28:44 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7CD4E3B72D; Tue, 9 Aug 2016 15:28:42 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-204-43.brq.redhat.com [10.40.204.43]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u79FSenv009203 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 9 Aug 2016 11:28:42 -0400 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id u79FSdU3013838; Tue, 9 Aug 2016 17:28:39 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id u79FSaKH013837; Tue, 9 Aug 2016 17:28:36 +0200 Date: Tue, 09 Aug 2016 15:28:00 -0000 From: Jakub Jelinek To: Cesar Philippidis Cc: "gcc-patches@gcc.gnu.org" , Fortran List Subject: Re: [openacc] add a warning for non-contiguous data clauses Message-ID: <20160809152836.GX14857@tucnak.redhat.com> Reply-To: Jakub Jelinek References: <57A17000.5030704@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <57A17000.5030704@codesourcery.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-SW-Source: 2016-08/txt/msg00035.txt.bz2 On Tue, Aug 02, 2016 at 09:16:00PM -0700, Cesar Philippidis wrote: > 2016-08-02 Cesar Philippidis > > 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