From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3372 invoked by alias); 3 Sep 2010 19:13:50 -0000 Received: (qmail 3341 invoked by uid 22791); 3 Sep 2010 19:13:48 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from troutmask.apl.washington.edu (HELO troutmask.apl.washington.edu) (128.208.78.105) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 03 Sep 2010 19:13:42 +0000 Received: from troutmask.apl.washington.edu (localhost.apl.washington.edu [127.0.0.1]) by troutmask.apl.washington.edu (8.14.4/8.14.4) with ESMTP id o83JDePk082930; Fri, 3 Sep 2010 12:13:40 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.14.4/8.14.4/Submit) id o83JDd1E082880; Fri, 3 Sep 2010 12:13:39 -0700 (PDT) (envelope-from sgk) Date: Fri, 03 Sep 2010 19:52:00 -0000 From: Steve Kargl To: Tobias Burnus Cc: fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: Re: [PATCH] fortran/45495 -- optional dummy args cannot not be in restricted expressions Message-ID: <20100903191339.GA78133@troutmask.apl.washington.edu> References: <20100903174436.GA18566@physik.fu-berlin.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100903174436.GA18566@physik.fu-berlin.de> User-Agent: Mutt/1.4.2.3i Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2010-09/txt/msg00293.txt.bz2 On Fri, Sep 03, 2010 at 07:44:36PM +0200, Tobias Burnus wrote: > Steve Kargl wrote: > > Including a check for intent(out) causes > > FAIL: gfortran.dg/spec_expr_2.f90 -O (test for excess errors) > > FAIL: gfortran.fortran-torture/compile/inquiry_1.f90, -O2 -fomit-frame-pointer > > > > troutmask:kargl[203] cat spec_expr_2.f90 > > ! { dg-do compile } > > ! PR 22273: Allow INTENT(OUT) dummy:s as arguments to LEN() in specification > > OK, a simple check won't do. But I believe my test case is still invalid: > > character(len=len(str(1:a))+1) :: b > > The issue is that "a" is not a string whose length is queried but that the > value of "a" itself is used - which is undefined if "a" is INTENT(OUT). > > > > Anyway, I'm confident that my original optional patch is correct. > > I concur. Thus, go ahead with that part. > > > > Inclusion of intent(out) seems to go against (7)(b)(iii) in that > > the property being inquired about is the length of the string. > > To quote only the relevant part of F2008's "7.1.11 Specification expression" > (with cutting out irrelevant parts and adding a comment in brackets): > > "A restricted expression is an expression in which each primary is > a specification inquiry [such as "LEN"] where each designator or function > argument is a restricted expression or a variable whose properties inquired > about are not defined by an expression that is not a restricted expression" > > I think the standard is pretty clear: > While "len(str)" and "str" are restricted expressions, "str(1:a)" is not; > thus, one should allow len(str) - even if "str" is INTENT(OUT) - but one > should reject "str(1:a)" - if "a" is INTENT(OUT). > I may have a fix the intent(out) issue as well. I testing it now. -- Steve