I am trying to get LFortran to compile a 3rd party code, which uses this. So I am trying to learn about how this feature works, as I have not encountered this before.
Thanks for your other comments. Based on what you wrote, is the above code equivalent to:
program test_module_dim
implicit none
integer :: nx
nx = 2
call f(nx, [1, 2])
nx = 3
call f(nx, [1, 2, 3])
contains
subroutine f(n, x)
integer, intent(in) :: n, x(n)
print *, size(x)
print *, x
end subroutine
end program
In other words, does it behave as if you passed the global variable explicitly as an argument?