(j3.2006) Still illegal in F08?

Van Snyder Van.Snyder
Tue Jan 5 21:57:38 EST 2010

On Tue, 2010-01-05 at 18:18 -0800, Malcolm Cohen wrote:
> Van Snyder wrote:
> > subroutine S ( X, A )
> >  real :: X(:)
> >  real, optional :: A(:)
> >  real :: B(merge(size(x),0,present(a))
> > end subroutine S
> ...
> >> Even though we expanded the list of inquiry functions to include them
> >> all, it seems that this is still illegal in F2008 because A is optional
> >> and therefore not a restricted expression,
> Yes.
> >> and "present" doesn't return
> >> an integer result and therefore the "present(A)" argument of "merge"
> >> isn't a restricted expression.
> Huh?  There is no mention of "integer result".

Yeah, it's the specification expression, not the restricted expression
that is required by C709 to have the integer result.

> >>  Item (9)(b)(3) in 7.1.11p2 on page 150
> >> in 09-007r3 appears to be the killer.
> Quite the reverse.
> PRESENT is an intrinsic inquiry function, and therefore a specification inquiry, 
> and the property of A being inquired about is certainly
> (i) NOT dependent on the upper bound of the last dimension of an assumed-size 
> array,
> (ii) NOT deferred, and
> (iii) NOT defined by an expression that is not a restricted expression.
> Therefore by 9(b) PRESENT(A) is a restricted expression,
> and therefore MERGE(1,2,PRESENT(A)) is also a restricted expression
> and thus by R728 a <specification-expr>.

The argument of PRESENT is an optional dummy argument, which 7.1.11p2(2)
says isn't a restricted expression.  Are the "properties inquired about"
it defined by an expression that is not a restricted expression?  It's
not obvious.  The properties inquired about A seem to be defined by A
(but not by its value), which is not a restricted expression.

Does 7.1.11p2(11) cause a problem if an optional argument is passed to
an optional dummy argument of a specification function, which according
to 7.1.11p2(2) is not a restricted expression?

Even if merge(size(x),0,present(a)) is OK, 7.1.11p2(2) together with
7.1.11p2(11) seem to make myfunc(x,a) illegal.  7.1.11p2(2) is probably
unnecessary since it's prohibited to reference an undefined value.  If
we must keep it can we add something that allows an INTENT(OUT) or
OPTIONAL dummy argument to be passed to a specification function?

> Cheers,

More information about the J3 mailing list