Inquire status of (non)allocatable arrays

I suggest you search whatever Fortran documentation you have and familiarize yourself with the distinction between
foo(a) !Name
foo(a(:)) !Designator
foo((a)) !Expression

When a Designator is used as an actual argument, some attributes of the name involved (“a”, in this case) are not “transmitted” to the dummy argument of foo, ALLOCATABLE being one (compilers usually enforce this and won’t let you do it).
When an Expression is used as an actual argument, the corresponding dummy argument of foo shall not be assigned to (compilers usually do not enforce this and will let you shoot your foot off, but the INTENT attribute can help you avoid this by spotting it at compile-time).

1 Like