From owner-sc22wg5@open-std.org  Wed Jul  7 15:22:52 2010
Return-Path: <owner-sc22wg5@open-std.org>
X-Original-To: sc22wg5-dom8
Delivered-To: sc22wg5-dom8@www2.open-std.org
Received: by www2.open-std.org (Postfix, from userid 521)
	id D992FC3BA0E; Wed,  7 Jul 2010 15:22:52 +0200 (CEST)
X-Original-To: sc22wg5@open-std.org
Delivered-To: sc22wg5@open-std.org
Received: from mailrelay1.lrz-muenchen.de (mailrelay1.lrz-muenchen.de [129.187.254.106])
	by www2.open-std.org (Postfix) with ESMTP id 4D658C3BA0A
	for <sc22wg5@open-std.org>; Wed,  7 Jul 2010 15:22:49 +0200 (CEST)
Received: from [129.187.15.179] ([129.187.15.179] [129.187.15.179]) by mailout.lrz-muenchen.de with ESMTP; Wed, 7 Jul 2010 15:22:30 +0200
Message-Id: <4C347F96.30406@lrz.de>
Date: Wed, 07 Jul 2010 15:22:30 +0200
From: Reinhold Bader <Reinhold.Bader@lrz.de>
User-Agent: Thunderbird 2.0.0.18 (X11/20081112)
MIME-Version: 1.0
To: John.Reid@stfc.ac.uk
Cc: ISO Fortran <sc22wg5@open-std.org>
Subject: Re: (SC22WG5.4282) [ukfortran] certain intrinsics and coindexed objects
References: <20100706200940.62F22C3BA05@www2.open-std.org> <20100707105555.45EF3C3BA0A@www2.open-std.org>
In-Reply-To: <20100707105555.45EF3C3BA0A@www2.open-std.org>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Sender: owner-sc22wg5@open-std.org
Precedence: bulk

Hello John,

John Reid schrieb:
> Reinhold.Bader@lrz.de wrote:
>> Hello all,
>>
>> Imagine the program
>>
>> program p
>>   integer, allocatable :: x[:]
>>
>>   allocate(x)
>>   sync all
>>   if (this_image() == 2) write(*,*) allocated(x[1])
>> end program
>>
>> Is this program standard-conforming?
> 
> No, but this program is:
> 
> program p
>   integer, allocatable :: x[:]
> 
>   allocate(x[*]) ! You forgot [*]

This was an out-of-focus typo, sorry.

>   sync all
>   if (this_image() == 2) write(*,*) allocated(x)
>        ! x[1] is an expression, not an allocatable array

I was hoping for this, but where in the standard does it say so?
From 6.1 and 6.2 it seems that one could rather conclude the
opposite. There are some situations where this is fine e.g.,

type :: f
  integer, allocatable :: i(:)
end type
type(f) :: o_f

... allocated(o_f%i)

and some where it's clear that it doesn't make sense (e.g.
 array sections). Note that the ALLOCATE statement has

R632 allocate-object is variable-name
                                   or structure-component

and any bounds or cobounds are separately specified.
Such an allocate-object is also the only thing that can
appear in DEALLOCATE. Why isn't the same applied
to ALLOCATED?



> end program
> 
>> If yes, would it still be conforming if the "sync all" statement is
>> dropped?
> 
> For the corrected program the "sync all" statement may be dropped.
> 
> Cheers,
> 
> John.

-- 
 Dr. Reinhold Bader

 Leibniz-Rechenzentrum, Abt. Hochleistungssysteme | Tel. +49 89 35831 8825
 Boltzmannstr. 1, 85748 Garching                  | Fax  +49 89 35831 9700
