Print

Print


i have a question about the size of a dummy adjustable array argument.
consider an example:

main program:
integer :: a(10)
call mysub(a(2:))

subroutine mysub(b)
  integer :: b(9)
  ....

the above is legal f90. but are the following two cases legal (for the
same main progam.

case a:
subroutine mysub(b)
  integer :: b(8)
  ....

case b:
subroutine mysub(b)
 integer :: b(10)
 ..

i am banking on case (a) being legal. the case (b) is just a curiosity
question. all three compile and run with two compilers (intel fortran and
ibm xlf) with array bounds checking. i'm surprised that case (b) worked, i
would have expected it be illegal.

renchi

PS: i know, i can use assumed-shape array, but i want to use adjustable
bounds, because i need to redimension my arrays at different points.