(j3.2006) COPY mode of argument association

Van Snyder Van.Snyder
Thu Dec 17 21:49:50 EST 2015


On Thu, 2015-12-17 at 18:39 -0800, Robert Corbett wrote:
> On 12/17/15 15:40, Van Snyder wrote:
> > Here's the recursive function reference:
> >
> > QTM_Trees%Q(root)%son(f) = Add_QTM_Vertex_To_Tree ( 4*QID+f )
> >
> > Add_QTM_Vertex_To_Tree is an internal function.  It can access QTM_Trees
> > by host association.  If QTM_Trees%Q runs out of space, it's reallocated
> > twice as big, the old one copied into the new, and then deleted.  So the
> > QTM_Trees%Q(root) in effect when Add_QTM_Vertex_To_Tree is invoked might
> > be a different one when it returns.
> 
> The assignment statement violates a restriction in the standard.  I know of
> implementations for which it will fail.
> 
> The restriction that the statement violates is presented in paragraph 2 of
> Subclause 7.1.4 of 15-007r2.  An earlier form of the restriction appeared
> in FORTRAN 77.  I did not find the restriction in FORTRAN 66, but I did not
> do a careful search.
> 
> The desired effect of the statement can be obtained by splitting the
> assignment statement.  First, assign the result of the function to a scalar
> variable, then assign the scalar variable to variable on the left-hand side
> of the original assignment.  A good optimizer should eliminate the new
> variable and the extra assignment.

Thanks to Bob for pointing at the right place in the standard to
understand this problem completely.





More information about the J3 mailing list