John Reid wrote:
> Given that copying is not allowed in this situation, the committee took
> the view that aliasing should be allowed, as in the direct use of the
> arrays.
I am still missing something. Assume we have the following procedure:
subroutine my_routine(a,b)
real, dimension(:), intent(inout) :: a, b ! No TARGET
a=a+b ! a and b can safely be assumed non-aliased
end subroutine my_routine
and that I then call it with aliased actual arguments:
real, dimension(100) :: a
call my_routine(a,a) ! What does the standard say of this!?!
It was always my impression that the call to my_routine was not legal in
Fortran and the compiler could either report an error or produce
unpredictable run-time behaviour. Am I wrong in this impression?
Because if I am right, then I cannot see how adding TARGET to a and b changes
the aliasing issue. I mean, true, the compiler *could* make two copies of a
and then call my_routine (and thus produce the "correct" result), but I
thought it was not required to do this. I thought it was the *user*'s
responsibility to make sure the actual arguments are non-overlapping.
So I still cannot see why the committee decided to allow aliasing of two
TARGET arguments (sorry, I do not have a copy of "Fortran 95 explained" :().
Thanks for any (further) clarification,
Aleksandar
|