From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 119888 invoked by alias); 28 Sep 2018 16:59:26 -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 119879 invoked by uid 89); 28 Sep 2018 16:59:25 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-0.2 required=5.0 tests=AWL,BAYES_40,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 spammy=UD:ac.uk, H*f:sk:f48efd1, arrayspec, sk:deferre X-HELO: ppsw-31.csi.cam.ac.uk Received: from ppsw-31.csi.cam.ac.uk (HELO ppsw-31.csi.cam.ac.uk) (131.111.8.131) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 28 Sep 2018 16:59:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=cam.ac.uk; s=20180806.ppsw; h=Sender:Content-Type:Mime-Version:References:In-Reply-To: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=ZjPIuJrVH6OarMqUdNrYGv2xEgodUE0eE8tLetDreM4=; b=gFkmU2MyNwrgWNr+umzNIlyxbe m7Vfz7pGDOG5K5c5SgEh5Y4ZaJdsPOHFZ87vPUl/bCxOZRRe+SwVcXeVj5zo1eJkmlHVOf93eDPxp 82ixx65VtaeqNiHhIumv+V2fHnd9uvOuGIWy/VZDQ3KMQ1FhRriPHMCdBIDyfovzoSo8=; Received: from hermes-2.csi.cam.ac.uk ([131.111.8.54]:58076) by ppsw-31.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.157]:25) with esmtpa (EXTERNAL:nmm1) id 1g5w6p-000Xy5-KZ (Exim 4.91) (return-path ); Fri, 28 Sep 2018 17:59:19 +0100 Received: from prayer by hermes-2.csi.cam.ac.uk (hermes.cam.ac.uk) with local (PRAYER:nmm1) id 1g5w6p-0007zC-Bx (Exim 4.91) (return-path ); Fri, 28 Sep 2018 17:59:19 +0100 Received: from [51.6.55.214] by old-webmail.hermes.cam.ac.uk with HTTP (Prayer-1.3.5); 28 Sep 2018 17:59:19 +0100 Date: Fri, 28 Sep 2018 16:59:00 -0000 From: "N.M. Maclaren" To: "Bader, Reinhold" Cc: Thomas Koenig , "fortran@gcc.gnu.org" Subject: Re: AW: [patch,wip] warn on noncontiguous pointers Message-ID: In-Reply-To: <2e72ca261ac34d0b839c112f8cee3600@lrz.de> References: <6c7d4e6ddec64bd8a326a95591b2bb47@lrz.de> <2e72ca261ac34d0b839c112f8cee3600@lrz.de> Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=ISO-8859-1 Sender: "N.M. Maclaren" X-IsSubscribed: yes X-SW-Source: 2018-09/txt/msg00218.txt.bz2 On Sep 28 2018, Bader, Reinhold wrote: >> >> >> If we go down the list, we see that fptr1(4:) is not contiguous; it >> >> is not an array (it is a pointer), so (4) also does not apply. >> > I don't agree with this conclusion. First, the array and pointer >> > properties are not mutually exclusive (they are conveyed by specifying >> > the DIMENSION and POINTER attribute, independently). >> >> Can you maybe elaborate a bit more? >> >> I see that you can associate a pointer with a target (6.7.1.4), which >> of course can be an array. But I have not found anything in the standard >> that says that a pointer to an array is an array. > > OK. Looking at 5.3.8.1 (Fortran 2008 for the sake of this discussion), we > have that an object that has the DIMENSION attribute is an array. > array-spec includes deferred-shape-spec-list, so any object declared with > deferred shape is an array. > > 5.3.8.4 then says C532 An array with the POINTER or ALLOCATABLE attribute > shall have an array-spec that is a deferred-shape-spec-list. > > and then has further text to say at what point things like SHAPE or SIZE > of such an object become defined. > >It can't get any clearer than that. My guess is that the root cause of the confusion is the phrasing 'pointer to an array', because that implies a model in which the pointer is separate. It's better called an array pointer, where the two properties are inseparable (for that name), and the comment "it is not an array (it is a pointer)" is not correct - it's both. Attributes are not qualifiers in the C sense. That's why several of us who teach Fortran tell C and C++ programmers that they will first have to unlearn much of what they know - the language's abstract model is extremely different! Regards, Nick Maclaren.