This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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] PR18578, PR18579, PR20857 and PR20885 - Constraints on INTENT(OUT and INOUT)


On Saturday 18 February 2006 18:35, Steve Kargl wrote:
> On Sun, Jan 29, 2006 at 12:13:34PM +0000, Paul Brook wrote:
> > On Sunday 29 January 2006 06:55, Paul Thomas wrote:
> > > This patch implements the obvious constraints on the use of INTENT(OUT
> > > and INOUT).  ie: that the actual argument should be a variable
> > > ("definable" in the standard) and that INTENT(OUT) variables should be
> > > defined or intialized before they are used or before return from the
> > > procedure.
> >
> > Variables that aren't defined should be caught be the normal unused
> > parameter/variable warnings. AFAIK there's nothing special about
> > INTENT(OUT) that requires it be defined.
>
> pault is almost quoting the language from the standard.  See page 53.
>
>    The INTENT(OUT) attribute specifies that the dummy argument shall
>    be defined before a reference to the dummy argument is made within
>    the procedure and any actual argument that becomes associated with
>    such a dummy argument shall be definable.  On invocation of the
>    procedure, such a dummy argument becomes undefined except for
>    components of an object of derived type for which default
>    initialization has been specified.
>
>    The INTENT(INOUT) attribute specifies that the dummy argument is
>    intended for use both to receive data from and to return data to
>    the invoking scoping unit.  Any actual argument that becomes
>    associated with such a dummy argument shall be definable.

There are two issues:

a) Actual arguments for intent(out) dummy arguments must be definable. This is 
fine.

b) intent(out) dummy arguments must be defined before the function returns. I 
don't see anything in the standard that requires this. AFAICS this is only 
illegal if the caller tries to reference the corresponding actual argument 
after the call.

Paul


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