From: Fortran 90 List [[log in to unmask]] on behalf of Bill Long [[log in to unmask]]
> On Mar 7, 2018, at 11:08 AM, Anton Shterenlikht <[log in to unmask]> wrote:
> The following program seems to be conforming in F2008 and F2018:
I’m not so sure. In the argument association rules in the standard (18.104.22.168 Allocatable dummy variables, para 3) I see that for a dummy argument that is allocatable, we require:
“ The corank of the actual argument shall be the same as that of the dummy argument.”
This prevents the procedure from allocating or deallocating a dummy that is not a coarray when the actual is a coarray.
Bill, thank you. I got lost in the document.
There seems to be quite a diversity of compiler checking for this:
Compiler 1. error:
z.f90(12): error #8397: The corank of the actual argument must be the same as that of the dummy argument. [I]
call s( i )
Compiler 2. warning:
Warning: Passing coarray at (1) to allocatable, noncoarray dummy argument 'a', which is invalid if the allocation status is modified [-Wsurprising]
Compiler 3. compiles with no warning, and runs fine.
I guess since the text you quote is not a constraint,
than allowing this can be classed as compiler extension?
And what about non-allocatable actual/dummy?
Is this conforming?
subroutine s( a )
integer, intent(inout) :: a(:)
write (*,*) sum(a)
end subroutine s
end module m
integer :: i(10)[*]
i = this_image()
call s( i )
write (*,*) 'ok'
end program p
If so, any way to find out inside the procedure whether
the passed variable was a coarray or not?