(j3.2006) Questions about 7.1.4p2

Van Snyder van.snyder
Fri Jan 8 03:43:24 EST 2016

There is a list in 7.1.4p2:

o  the evaluation of a function reference shall neither affect nor be
   affected by the evaluation of any other entity within the statement;

o  if a function reference causes definition or undefinition of an
   actual argument of the function, that argument or any associated
   entities shall not appear elsewhere in the same statement.

It seems that the second item is covered by the first one.  Is there
something I've missed here?

If the second isn't covered by the first, the second should include
change to pointer association status, and maybe allocation status.
Perhaps another list item is necessary also:

o  if a function reference causes definition, undefinition, or change
   of the allocation status or pointer association status of a global
   variable or a variable accessed by host or use association, neither
   that variable nor any associated entities shall appear elsewhere in
   the same statement.

If you have

a(i:j) = f(x)

and f accesses i or j by host or use association, you probably either
don't want f to change them, or you don't want to use them in the LHS of
the assignment statement.  Even worse, what if f accesses a by host or
use association, and it's allocatable or a pointer, and f reallocates

But then, in

b = g(x)

what if b is polymorphic or allocatable and gets reallocated because the
dynamic type, a length parameter, or extent, are not the same as the
result of g(x).  Is there a conflict here?  Is it the function
reference, or evaluation of the function reference, that results in
changing b?

Perhaps the second list item, and the proposed additional one, should
have "evaluation of a function reference" instead of simply "a function

More information about the J3 mailing list