From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 55746 invoked by alias); 11 Oct 2018 19:37:47 -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 55726 invoked by uid 89); 11 Oct 2018 19:37:47 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=4.1 required=5.0 tests=AWL,BAYES_20,GARBLED_SUBJECT,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=H*f:sk:c0ed507, f2018, Jerry, jerry X-HELO: mx-relay43-hz2.antispameurope.com Received: from mx-relay43-hz2.antispameurope.com (HELO mx-relay43-hz2.antispameurope.com) (94.100.136.243) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 11 Oct 2018 19:37:45 +0000 Return-Path: Received: from s041.bre.qsc.de ([195.90.7.81]) by mx-relay43-hz2.antispameurope.com; Thu, 11 Oct 2018 21:37:42 +0200 Received: from tux.net-b.de (port-92-194-24-29.dynamic.qsc.de [92.194.24.29]) by s041.bre.qsc.de (Postfix) with ESMTPSA id D2BA22C00C7; Thu, 11 Oct 2018 21:37:41 +0200 (CEST) Subject: =?UTF-8?Q?Re=3a_=5bPatch=2c_Fortran=5d_PR_fortran/83522_=e2=80=93_r?= =?UTF-8?Q?eject_array-valued_substrings?= To: Jakub Jelinek Cc: fortran@gcc.gnu.org References: <20181011104640.GA25103@tucnak> From: Tobias Burnus Message-ID: Date: Thu, 11 Oct 2018 19:37:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: <20181011104640.GA25103@tucnak> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-cloud-security-sender:burnus@net-b.de X-cloud-security-recipient:fortran@gcc.gnu.org X-cloud-security-Virusscan:CLEAN X-cloud-security-disclaimer: This E-Mail was scanned by E-Mailservice on mx-relay43-hz2.antispameurope.com with 303CCBCF0BD X-cloud-security-connect: s041.bre.qsc.de[195.90.7.81], TLS=1, IP=195.90.7.81 X-cloud-security:scantime:.1703 X-IsSubscribed: yes X-SW-Source: 2018-10/txt/msg00048.txt.bz2 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 == NULL). >> >> As Jerry has dug up in the standard (F2008, R610 alias F2018, R908), >> substrings are only permitted on scalars (or array elements). – [gfortran >> has some partial support for noncontiguous memory as actual argument the 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 – it comes too late to >> print a nice error message for "string(:)(:)"; that statement gets matched >> unsuccessfully and at the end the buffered error message of match_variable >> (unexpected character "(") gets printed. – 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=1,length=4) :: 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 rank, another > part-ref shall have nonzero rank, or the complex-part-designator > shall be an array. > C926 (R918) If a substring-range appears, the rightmost part-name shall be of type > character. > and in that case: > > An array element is a scalar. An array section is an array. If a substring-range > appears in an array-section, each element is the designated substring of the > corresponding element of the array section. > > applies. > > Jakub