(j3.2006) Simple coarray declaration questions

Tobias Burnus burnus
Wed Jun 1 03:01:17 EDT 2011

The following is probably trivial, but I still cannot make up my mind. 
The code compiles with three compilers and is rejected with one. Is the 
following program valid or not? I think it is invalid:

   subroutine test2()
     type t
       integer, allocatable :: a(:)[:]
     end type t
     type(t) :: x
   end subroutine test2

   C526 A coarray or an object with a coarray ultimate
        component shall be a dummy argument or have the
        ALLOCATABLE or SAVE attribute.

  * * *

And another example, rejected by two compilers, accepted by two:

subroutine sub(n)
   integer :: n
   integer, SAVE :: A(4)[n,*]
end subroutine sub

The rejecting compiler claim that the bounds need to be constant for 
automatic arrays. I think the example is valid. While there is

C513 An automatic object shall not have the SAVE attribute.

the following shouldn't apply: "An automatic data object is a nondummy 
data object with a type parameter or array bound that depends on the 
value of a specification-expr that is not a constant expression."
Note the "bound" and not "cobound" (Cf. "1.3.27 cobound: bound (limit) 
of a codimension" vs. "1.3.17 bound / array bound: limit of a dimension 
of an array".)

Is it indeed valid?


More information about the J3 mailing list