[fortran PATCH] Implement a(:,:) = 0.0 using memset

roger@eyesopen.com roger@eyesopen.com
Mon Dec 18 17:58:00 GMT 2006


Hi Tobi,
> Does this work for strided arrays?  Say
> program t
>   real :: arr(4)
>   call a(arr(1:4:2))
>   print *, arr
> contains
> subroutine a(b)
>    real :: b(:)
>    b(:) = 0
> end subroutine
> end program

It works in the sense that it knows to leave the assignment of "b(:)"
alone and not use memset.  In theory, it should be possible to inspect
the array descriptor at run-time and determine whether the array sections
are sequential, but currently if the array reference requires an array
descriptor, this optimization is skipped.  This may be too conservative
for some common codes?  It'd be nice to have some statistics.

Roger
--




More information about the Fortran mailing list