(j3.2006) Simple coarray declaration questions

Bill Long longb
Wed Jun 1 14:15:21 EDT 2011



On 6/1/11 8:46 AM, Jim Xia wrote:
>
>  > >> 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.
>

Auto-deallocation of a coarray is supported.  See, for example, 
[131:20-22].  The reason is to allow recursive procedures with 
allocatable local coarrays.   The semantics would be quite different if 
they were required to have the 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
>  > >>
>  > >>
>  > >> Is it indeed valid?
>  >
>  > Yes, as explained below.
>
>
> I still think allowing this is a mistake.
>

The cobounds are only used locally to translate cosubscripts into an 
image number.  This is one of the most trivial parts of implementing 
coarrays.  Why do you think there is a potential problem with this?

Cheers,
Bill



> Cheers,
>
>
> Jim Xia
>
> Compiler Testing, X10 & XLF
> IBM Toronto Lab at 8200 Warden Ave,
> Markham, On, L6G 1C7
> 905-413-3444

-- 
Bill Long                                           longb at cray.com
Fortran Technical Support    &                 voice: 651-605-9024
Bioinformatics Software Development            fax:   651-605-9142
Cray Inc./Cray Plaza, Suite 210/380 Jackson St./St. Paul, MN 55101





More information about the J3 mailing list