This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] fortran/45495 -- optional dummy args cannot not be in restricted expressions


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]