[comp.lang.fortran] Array sections and optimization

mccalpin@masig1.ocean.fsu.edu (John D. McCalpin) (06/28/89)

The current draft allows array section assignments to read from the
area that they are writing to, thus requiring a temporary array.

One vendor that I have spoken to expressed concern that significant
extra optimization would be required to decide if that scratch array
could be eliminated, and that (in the absence of this optimization)
the overhead of allocating the extra storage and then copying the
results back to the desired output location could generate a
significant performance penalty.  Even more optimization might be
needed to determine whether the scratch space might be reduced in one
or more dimensions, while the programmer usually provides this
information when coding the operation in loops.

Has anyone discussed the merits of removing this "feature" from the
array section notation?  The revision would require that the
programmer must guarantee that the statement cannot be order-
dependent.  If the programmer is incorrect, of course the answers are
not likely to be correct either....

Thus, the example in the draft would be disallowed:
	A(1:10) = A(10:1:-1)		! requires scratch vector
and the programmer would have to provide the scratch array manually.
--
John D. McCalpin - mccalpin@masig1.ocean.fsu.edu - mccalpin@nu.cs.fsu.edu