(j3.2006) Simple coarray declaration questions

Jim Xia jimxia
Wed Jun 1 09:46:22 EDT 2011


> >>    subroutine test2()
> >>      type t
> >>        integer, allocatable :: a(:)[:]
> >>      end type t
> >>      type(t) :: x
> >>      allocate(x%a(1)[*])
> >>    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.
> >
> > It is not valid since the constraint is not satisfied.
> 
> I agree, although for this example the constraint is a bit of overkill. 


I thought the SAVE is needed to avoid the auto-deallocation of alloactable 
components if the objects are declared locally within a subprogram.  SAVE 
attribute will avoid the auto-deallocation problem.



> >>
> >> And another example, rejected by two compilers, accepted by two:
> >>
> >> subroutine sub(n)
> >>    integer :: n
> >>    integer, SAVE :: A(4)[n,*]
> >> end subroutine sub
> >>
> >>
> >> Is it indeed valid?
> 
> Yes, as explained below.


I still think allowing this is a mistake.

Cheers,


Jim Xia

Compiler Testing, X10 & XLF
IBM Toronto Lab at 8200 Warden Ave,
Markham, On, L6G 1C7
905-413-3444
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://j3-fortran.org/pipermail/j3/attachments/20110601/6ac6c69a/attachment.html>



More information about the J3 mailing list