From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 86731 invoked by alias); 11 Oct 2018 19:40:06 -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 86707 invoked by uid 89); 11 Oct 2018 19:40:06 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: Yes, score=6.3 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,GARBLED_SUBJECT,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=no version=3.3.2 spammy=HTo:U*burnus, H*f:sk:c0ed507, f2018, Jerry X-HELO: mail-yw1-f65.google.com Received: from mail-yw1-f65.google.com (HELO mail-yw1-f65.google.com) (209.85.161.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 11 Oct 2018 19:40:04 +0000 Received: by mail-yw1-f65.google.com with SMTP id a197-v6so4056222ywh.9 for ; Thu, 11 Oct 2018 12:40:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=l7RTye8vXHCLw1MjXpj20DXnSk2zASN75+mEnUBQJlw=; b=HFtU+3wlVzqJYgE19iwAr4Rm9K5lFPvYYNxtPjPRoQ0ENJ8jn6bDNrWPf3rJDvw6hU g8Q4UG1MsA5CQ6kU9sGlw7leVk+jM/+t9a9nURYkcI94DFftVmBJC8gFHpwJQCpMer7p bTGDcltLwJ0eEXeoPgwcT31rstwMlmWyyE6Cn6gw2cNwTebg0/ENffwsGFCmMkjf1Jpi eLpGoEu2e0PhTCIkC4VrscptfwHY1GdxhTdVZ6kf+NygZRZ4c6UuN8qBolovTMpNGd4l r6GIXV7NXXxSzor1m19TNCsyvYQVE1C0h5DAUwcOYW2Ni23BFfg6Bywe6rOY/5miqIFo HnWA== MIME-Version: 1.0 References: <20181011104640.GA25103@tucnak> In-Reply-To: From: Paul Richard Thomas Date: Thu, 11 Oct 2018 19:40:00 -0000 Message-ID: Subject: =?UTF-8?Q?Re=3A_=5BPatch=2C_Fortran=5D_PR_fortran=2F83522_=E2=80=93_reject_arr?= =?UTF-8?Q?ay=2Dvalued_substrings?= To: Tobias Burnus Cc: Jakub Jelinek , "fortran@gcc.gnu.org" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2018-10/txt/msg00049.txt.bz2 Hi Tobias, I am sorry that your return has proven to be a bit bloody. Thanks for reverting it. I am afraid that Jerry missed the context completely. Regards Paul On Thu, 11 Oct 2018 at 20:37, Tobias Burnus wrote: > > In light of the somehow missed test-suite fails and the discussion about > rejecting too much, I have reverted the patch with commit r83522. > > Tobias > > Am 11.10.18 um 12:46 schrieb Jakub Jelinek: > > On Mon, Oct 08, 2018 at 09:44:57PM +0200, Tobias Burnus wrote: > >> as the PR (and the attached testcase) shows, gfortran doesn't handle > >> noncontiguous access with substrings. Namely, "str_array(:)(1:5)" is > >> mishandled (segfault while building the "tree" as expr =3D=3D NULL). > >> > >> As Jerry has dug up in the standard (F2008, R610 alias F2018, R908), > >> substrings are only permitted on scalars (or array elements). =E2=80= =93 [gfortran > >> has some partial support for noncontiguous memory as actual argument t= he now > >> rejected test cases show.] > >> > >> In words of the standard (here: F2018): > >> > >> 9.4.1 Substrings > >> > >> A substring is a contiguous portion of a character string (7.4.4). > >> > >> R908 substring is parent-string ( substring-range ) > >> > >> R909 parent-string > >> is scalar-variable-name > >> or array-element > >> or coindexed-named-object > >> or scalar-structure-component > >> or scalar-constant > >> > >> The patch adds a check to the variable resolving =E2=80=93 it comes to= o late to > >> print a nice error message for "string(:)(:)"; that statement gets mat= ched > >> unsuccessfully and at the end the buffered error message of match_vari= able > >> (unexpected character "(") gets printed. =E2=80=93 One could reject it= earlier but > >> the code doesn't seem to be that nice. (See PR for a variant.) > >> > >> Build and regtested on x86_64-linux. > >> OK for the trunk? > > As I wrote in the PR, I believe it is incorrect and should be reverted. > > While for > > character(kind=3D1,length=3D4) :: f(4,5) > > e.g. > > f(:,:)(1:2) > > is not matching the substring non-terminal, it is IMNSHO matching the > > array-section non-terminal: > > R918 array-section > > is data-ref [ ( substring-range ) ] > > or complex-part-designator > > C925 (R918) Exactly one part-ref shall have nonzero rank, and either = the final > > part-ref shall have a section-subscript-list with nonzero r= ank, another > > part-ref shall have nonzero rank, or the complex-part-desig= nator > > shall be an array. > > C926 (R918) If a substring-range appears, the rightmost part-name sha= ll be of type > > character. > > and in that case: > > > > An array element is a scalar. An array section is an array. If a substr= ing-range > > appears in an array-section, each element is the designated substring o= f the > > corresponding element of the array section. > > > > applies. > > > > Jakub --=20 "If you can't explain it simply, you don't understand it well enough" - Albert Einstein