From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29736 invoked by alias); 31 May 2011 18:39:17 -0000 Received: (qmail 29720 invoked by uid 22791); 31 May 2011 18:39:16 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mx02.qsc.de (HELO mx02.qsc.de) (213.148.130.14) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 31 May 2011 18:38:58 +0000 Received: from [192.168.178.22] (port-92-204-18-93.dynamic.qsc.de [92.204.18.93]) by mx02.qsc.de (Postfix) with ESMTP id C5D321E32D; Tue, 31 May 2011 20:38:56 +0200 (CEST) Message-ID: <4DE535C0.8070905@net-b.de> Date: Tue, 31 May 2011 20:52:00 -0000 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.14) Gecko/20110221 SUSE/3.1.8 Thunderbird/3.1.8 MIME-Version: 1.0 To: gcc patches , gfortran Subject: Re: [Patch, Fortran] Support static coarrays with "automatic" cobounds References: <4DE38ED2.8010405@net-b.de> In-Reply-To: <4DE38ED2.8010405@net-b.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-05/txt/msg02469.txt.bz2 Tobias Burnus wrote: > gfortran currently rejects: > subroutine foo(n) > integer, SAVE :: foo(500)[n, *] > claiming that as SAVE does not work with automatic arrays. The patch for this has been committed (Rev. 174503) after approval by Daniel Kraft on IRC (#gfortran). Thomas Koenig wrote: > To me, that sounds a lot like a mistake in the standard. Maybe ask on > c.l.f? It is not completely clear to me what you mean by mistake. Coarrays are kind of special in several respects. Except of deferred-shape coarrays (i.e. allocatable coarrays), the codimension is always assumed site, independently whether the dimension makes the coarray a scalar, explict-size, assumed-size, or assumed-shape array: integer :: A[*] integer :: B(:,:,:)[4,5:*] integer :: C(*)[1:*] integer :: D(5)[1:*] but integer, allocatable :: E(:)[:] This works as the codimension (coshape) does not influence the storage but just the index calculation between coindex and image index, when accessing remote images. Thus, there is no reason why one should pose restrictions on the coshape for static arrays. (By definition, all coarrays are either static ("SAVE") or allocatable.) I think in some cases, it can be really useful. As the size of the codimension is only known at run time (it's num_images()), it can make sense to define the coshape only at run time - even if the shape itself is a compile-time constant. Another peculiarity is that for a coarray "integer :: A(10,10)[*]" the actual argument remains a coarray in: call proc(A), call proc(A(1,1)), call proc(A(:,1)), call proc(2:3,4) etc. (I think the actual argument needs to be simply contiguous to make this work by preventing copy-in/copy-out.) Note: call proc(A[5]) is coindexed, but not a coarray. Tobias