Compile the following program with ifort 13.1.0.146. You would expect the compiler not to create a temporary copy of x(:,:,:,1,2) in subroutine f. But it does. Using UBOUND seems to be a viable workaround.
[fortran]
program test
double precision, allocatable :: x(:, :, :, :, :)
double precision y(200, 200, 200, 2, 2)
integer n1, n2, n3, n4, n5
read *, n1, n2, n3, n4, n5
allocate(x(n1, n2, n3, n4, n5))
call f(x)
call f(y)
contains
subroutine f(x)
double precision x(:, :, :, :, :)
print *, shape(x(:, :, :, 1, 2))
end subroutine
end program[/fortran]
連結已複製
2 回應
