Drew McCormack wrote:
> program main
> use A
> real :: b(10), c(10,10)
> call sub( b(2:5) )
> call sub( c(2:8, 2:5) )
> end program
> Is this allowed?
Yes, it is, the compiler ought to make a contiguous copy and pass it on.
Unless you provide an actual example which produces wrong results, I
cannot say more, but I seriously doubt the XLF compiler would get this
wrong.
This should work fine:
subroutine sub( array )
real :: array(10)
write(*,*) array
end subroutine
program main
real :: a(13), b(10), c(10,10)
integer :: i,j
do i=1,10
do j=1,10
c(i,j)=100*i+j
end do
end do
call sub(c(1:5:2,5:8))
end program
[1071 tmp @ atom]$ explicit.x
1.0500000E+02 3.0500000E+02 5.0500000E+02 1.0600000E+02
3.0600000E+02 5.0600000E+02 1.0700000E+02 3.0700000E+02
5.0700000E+02 1.0800000E+02
Best,
Aleks
|