I would like to have an associate that points to an array (or parts thereof) and is not one indexed. The following program illustrates the problem:
program test_associate
implicit none(type, external)
integer, parameter :: N = 10
integer :: i, A(0 : N - 1)
A = [(i, i = lbound(A, 1), ubound(A, 1))]
write(*, *) A(0), A(9)
associate(B => A(0 : N - 1))
write(*, *) B(9) ! This writes 8 but should write 9
end associate
end program
I tried
associate(B(0 : N - 1) => A(0 : N - 1))
write(*, *) B(9)
end associate
but this is invalid syntax. (at least in my compiler which is gfortran 9.3)