From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1932 invoked by alias); 4 Nov 2010 09:10:05 -0000 Received: (qmail 1917 invoked by uid 22791); 4 Nov 2010 09:10:04 -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 mx01.qsc.de (HELO mx01.qsc.de) (213.148.129.14) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 04 Nov 2010 09:09:59 +0000 Received: from [192.168.178.22] (port-92-204-92-55.dynamic.qsc.de [92.204.92.55]) by mx01.qsc.de (Postfix) with ESMTP id 4FF6C3CE35; Thu, 4 Nov 2010 10:09:53 +0100 (CET) Message-ID: <4CD27860.50709@net-b.de> Date: Thu, 04 Nov 2010 10:08:00 -0000 From: Tobias Burnus User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101026 SUSE/3.1.6 Thunderbird/3.1.6 MIME-Version: 1.0 To: Paul Richard Thomas CC: fortran@gcc.gnu.org, gcc-patches , Dominique Dhumieres Subject: Re: (Re)allocation of allocatable arrays on assignment - F2003 References: <20101009134002.157E83BE0F@mailhost.lps.ens.fr> <20101023202653.2DF9D3BE18@mailhost.lps.ens.fr> <4CC47A12.7050504@net-b.de> <20101031215043.8B69A3BE18@mailhost.lps.ens.fr> <20101101101824.F0F663BE18@mailhost.lps.ens.fr> <20101102222221.CB2BB3BE18@mailhost.lps.ens.fr> <4CD273ED.7040903@net-b.de> <4CD27535.5020509@net-b.de> In-Reply-To: <4CD27535.5020509@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: 2010-11/txt/msg00397.txt.bz2 On 11/04/2010 09:56 AM, Tobias Burnus wrote: > On 11/04/2010 09:50 AM, Tobias Burnus wrote: >>> Bootstrapped and regtested on FC9/x86_64 - OK for trunk? >>> > Before you commit, can you add [...] Another post script: Can you add a condition that no reallocation happens for coarrays/coindexed variables? That's not a correctness issue (the RHS must have the same size as the LHS -- otherwise the program is invalid) but a performance issue. [Actually, in terms of array bounds, it might also be a correctness issue.] Example: subroutine sub integer, allocatable :: a(:)[:] a = [8] ! Right-most partref of LHS is a coarray (attr.codimension != 0) end type t integer, allocatable :: alloc_comp(:) end type t contains subroutine sub2(a) type(t) :: a[*] a[1]%alloc_comp = [8] ! LHS is coindexed end Cf. F2008, "7.2.1.2 Intrinsic assignment statement": "In an intrinsic assignment statement, [...] (3) the variable and expr shall be conformable unless the variable is an allocatable array that has the same rank as expr and is neither a coarray nor a coindexed object," The attr.codimension check can be added at the same place as the attr.allocatable check as both is with regards to the right most partref. The coindexed check can be done by calling gfc_is_coindexed (expr). Tobias