From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) by sourceware.org (Postfix) with ESMTPS id 724563858409; Mon, 29 Nov 2021 21:11:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 724563858409 X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from gluon.fritz.box ([79.251.15.55]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1M8QWG-1mwDmx06KW-004Uf1; Mon, 29 Nov 2021 22:11:43 +0100 Subject: Re: [PATCH, Fortran] Fix setting of array lower bound for named arrays To: Tobias Burnus , Chung-Lin Tang , Fortran List , gcc-patches Newsgroups: gmane.comp.gcc.fortran,gmane.comp.gcc.patches References: <3ff664cf-c928-6179-d0d4-728401987264@codesourcery.com> From: Harald Anlauf Message-ID: Date: Mon, 29 Nov 2021 22:11:41 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <3ff664cf-c928-6179-d0d4-728401987264@codesourcery.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:ud+ow7jV6ks8Sllvhqx6KDGx6WidL7nvZvnkdwrGB6SklUa67V1 9hq6cA/otI1HIbdaSqb3MbG9NZcwjCG4WkaSFvQKcHDDOqOMu056qoYNPOjl7Ww9mhOkSX1 W40nn+76QKB7iTquGN1SqHAFhMWxufSuCjmqjr6DJ7hV+wW9GYtPcdvFz2lkaF70LdZbS1V dWrrZwdY1CvZ9vS5WmdWA== X-UI-Out-Filterresults: notjunk:1;V03:K0:Vra3xI+yawU=:3KzmdXIR6kndfZC9Q/dhrA tA1Gxacew5bnUKD/uY1v78fMrYsxKY1aaPAZMBIiVQci94Fx+GTdC3nPZ96jcSQ4I1jWEFjHB vcJhxSf+1a2p2n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ALID, FREEMAIL_FROM, NICE_REPLY_A, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Nov 2021 21:11:49 -0000 Hi Tobias, all, Am 29.11.21 um 21:56 schrieb Tobias Burnus: > The problem is that the standard does not really state what the bounds > are :-( I sort of expected that comment... > Usually, it ends up referring to LBOUND (with wordings like "each lower > bound equal to the corresponding element of LBOUND (expr)") =E2=80=93 al= beit not > in this case. > > Assuming that holds, the question is what's lbound(h(3))? gfortran gives > [1] for that one. What does NAG yield? > > For lbound(h(3),dim=3D1), the standard has: > > "If DIM is present, ARRAY is a whole array, and either ARRAY is an > assumed-size array of rank DIM or dimension DIM of ARRAY has nonzero > extent, the result has a value equal to the lower bound for subscript > DIM of ARRAY. Otherwise, if DIM is present, the result value is 1." > > Thus, the question is whether "h(3)" is a 'whole array' or not. That rea= ds: F2018: 9.5.2 Whole arrays > "A whole array is a named array or a structure component whose final > part-ref is an array component name; no subscript list is appended." > > I think in "h(3)" there is not really a named array =E2=80=93 thus I rea= d it as > if the "Otherwise ... result value is 1" applies. If you read on in the standard: "The appearance of a whole array variable in an executable construct specifies all the elements of the array ..." which might make you/makes me think that the sentence before that one could need an official interpretation... I've submitted a reduced example to the Intel Fortran Forum: https://community.intel.com/t5/Intel-Fortran-Compiler/Allocate-with-SOURCE= -and-bounds/m-p/1339992#M158535 There are good chances that Steve Lionel reads and comments on it. You're invited to add to that thread! Harald > Tobias > > ----------------- > Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstra=C3=9Fe = 201, > 80634 M=C3=BCnchen; Gesellschaft mit beschr=C3=A4nkter Haftung; Gesch=C3= =A4ftsf=C3=BChrer: > Thomas Heurung, Frank Th=C3=BCrauf; Sitz der Gesellschaft: M=C3=BCnchen; > Registergericht M=C3=BCnchen, HRB 106955 >