From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ciao.gmane.io (ciao.gmane.io [116.202.254.214]) by sourceware.org (Postfix) with ESMTPS id 23B103858D29 for ; Wed, 22 Sep 2021 19:47:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 23B103858D29 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1mT8DB-0004K0-Sv for fortran@gcc.gnu.org; Wed, 22 Sep 2021 21:47:21 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: fortran@gcc.gnu.org From: Harald Anlauf Subject: Re: [Patch] Fortran: Handle allocated() with coindexed scalars [PR93834] (was: [PATCH] PR fortran/93834 - [9/10/11/12 Regression] ICE in trans_caf_is_present, at fortran/trans-intrinsic.c:8469) Date: Wed, 22 Sep 2021 21:47:12 +0200 Message-ID: References: <80aebd97-e817-9c80-2eba-bd9e81349289@codesourcery.com> <7ac2b19a-d108-a0de-8e43-b42c4583f4a5@codesourcery.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 In-Reply-To: <7ac2b19a-d108-a0de-8e43-b42c4583f4a5@codesourcery.com> Content-Language: en-US Cc: gcc-patches@gcc.gnu.org X-Spam-Status: No, score=0.4 required=5.0 tests=BAYES_00, FORGED_MUA_MOZILLA, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: fortran@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Fortran mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Sep 2021 19:47:24 -0000 Hi Tobias, Am 07.09.21 um 16:33 schrieb Tobias Burnus: > Now I actually tested the patch – and fixed some issues. > > OK? – It does add support for 'allocated(a[i])' by treating > it as 'allocated(a)', as 'a' must be collectively allocated > ("established") on all images of the team.* > > 'a[i]' is (probably) an allocatable, following Malcolm in > answer to my question to the J3-list as linked below. while still feeling somewhat unsure (given my previous comment and the discussion), I think your patch is basically OK. However, your testcase has a { dg-do compile }, so it does not really do any runtime tests. Is that intended? If so, please add a respective comment, or adjust the testcase. Otherwise this LGTM. Thanks for the patch! Harald > Tobias > > * Ignoring issues related to failed images. It could > also be handled by fetching 'a' from the remote > image, but I am not sure that's better in terms of > handling failed images. > > PS: > On 07.09.21 10:02, Tobias Burnus wrote: >> Hi Harald, >> >> I spend yesterday about two hours with this. Now I am still >> tired but understand more. I think the confusion between the >> two of us is due to wording and in which directions the >> thoughts then go: >> >> >> Talking about coindexed, all of a[i], b[i]%c and c%d[i] are >> coindexed and there are many constraints like "shall not be >> a coindexed variable" – which then rejects all of those. >> That's what I was thinking of. >> >> I think your starting point is that while ('a' = allocatable) >>   a, b%a, c[5]%d(1)%a >> are ALLOCATABLE, adding a subobject reference such as >>   a(:), b%a(:,:), c[5]%d(1)%a(:,:,:) >> makes the variable no longer allocatable. >> I think that's what you were thinking of. >> >> We then both argued along those different lines – which caused >> the confusion as we both thought we talked about the same. >> >> >> While those cases are clear, the question is whether >>   a[i] or b%a[i] >> is allocatable or not – assuming that 'a' is a scalar. >> (For an array, '(:)' has to appear before the image-selector, >> which in turn makes it nonallocatable.) >> >> >> I tried to pinpoint the words for this in the standard – and >> failed. I think I need a "how to read the Fortran standard" 101 >> and some long time actually reading it :-( >> >> Malcolm has answered me – and he believes (but only offhand) that >>   a[i]  and  b%a[i] >> _are_ allocatable. See (6) at >> https://mailman.j3-fortran.org/pipermail/j3/2021-September/013322.html >> >> >> This implies that >>   if ( allocated (a[i]) .and. allocated (b%a[i]) ) stop 1 >> is valid. >> >> However, I do note that coarray allocatables have to be collectively >> (de)allocated, therefore >>   allocated (a[i]) .and. allocated (b%a[i]) >> is equivalent to >>   allocated (a) .and. allocated (b%a) >> at least assuming that no image has failed. >> >> >> First: Does this answer all the questions you had and resolved the >> confusion? >> Secondly, do you agree about the last bits of the analysis? >> Thirdly, what do you think of the attached patch? >> >> Tobias > ----------------- > Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, > 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: > Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; > Registergericht München, HRB 106955