From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from moene.org (84-86-97-173.fixed.kpn.net [84.86.97.173]) by sourceware.org (Postfix) with ESMTPS id AF5013858010 for ; Sat, 30 Jul 2022 14:36:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AF5013858010 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=moene.org Authentication-Results: sourceware.org; spf=none smtp.mailfrom=moene.org Received: from localhost ([127.0.0.1]) by moene.org with esmtp (Exim 4.96) (envelope-from ) id 1oHnDJ-005yzt-0J; Sat, 30 Jul 2022 16:13:09 +0200 Message-ID: <48bb1d77-182d-cd8c-1ff9-047a9c5755c9@moene.org> Date: Sat, 30 Jul 2022 16:13:08 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH, v2] Fortran: fix invalid rank error in ASSOCIATED when rank is remapped [PR77652] Content-Language: en-US To: Mikael Morin , Harald Anlauf , fortran@gcc.gnu.org References: <8e300265-e24c-59c2-19b0-3d74fc5ed425@orange.fr> <2c940b18-08f2-adeb-6ac3-22e89b72440d@orange.fr> <5504785b-7471-f51e-852a-5ef9b039cc21@orange.fr> From: Toon Moene Organization: Moene Computational Physics, Maartensdijk, The Netherlands In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KAM_SHORT, KHOP_HELO_FCRDNS, NICE_REPLY_A, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: Sat, 30 Jul 2022 14:36:09 -0000 Looks good to me. Thanks ! Toon. On 7/30/22 12:03, Mikael Morin wrote: > Le 28/07/2022 à 22:19, Mikael Morin a écrit : >> I propose to prepare something tomorrow. >> > > Here you go.  I haven’t found a procedure, a template or guidelines on > wg5-fortran.org, so I’m just asking questions as free text. > I have not put every combination of cases to limit the number of > examples, but an answer for each example should give a good picture. > Anything to correct or change?  Anything to add? > > Mikael > > > Hello, > > we are contributors to gfortran.  We have been discussing the > restrictions a processor is required to put on ASSOCIATED functions > calls with regards to rank mismatch in the thread at: >> https://gcc.gnu.org/pipermail/fortran/2022-July/058012.html > The following discussions are on the same topic as well: >> https://groups.google.com/g/comp.lang.fortran/c/BQfpeDZxX3Q >> https://community.intel.com/t5/Intel-Fortran-Compiler/Intel-rejects-ASSOCIATED-pointer-target-for-non-equal-ranks/m-p/1402799/highlight/true#M162159 >> > > The position from Steve Lionel in the latter threads is that a processor > is required to reject an ASSOCIATED function call with arguments of > mismatching ranks as there is no bounds-remapping list. > Our understanding is that a processor shall accept it as long as it may > accept a corresponding pointer association statement with additional > bounds-remapping list. > > Our poll of existing compilers shows the same disagreement, with two > accepting mismatching ranks (cray 14.0, nvidia 22.5) and two rejecting > them (NAG 7.0 & 7.1, Intel). > > So we would like an official interpretation on this topic. > More specifically, for each program below, is a processor (at compile > time) required to reject it, allowed to reject it but not required to, > or required to accept it? > > Harald Anlauf, Mikael Morin > > !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! > > ! Example 1 > ! matrix pointer vs array target > program p >   real, dimension(100),  target  :: array >   real, dimension(:,:),  pointer :: pmatrix => null() >   print *, associated(pmatrix, array) > end > > !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! > > ! Example 2 > ! array pointer vs matrix target > program p >   real, dimension(20,5), target  :: matrix >   real, dimension(:),    pointer :: parray => null() >   print *, associated(parray, matrix) > end > > !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! > > ! Example 3 > ! array pointer vs rank 2 non-contiguous target > program p >   real, dimension(20,5), target  :: matrix >   real, dimension(:),    pointer :: parray => null() >   print *, associated(parray, matrix(1:20:3, 1:5:2)) > end > > !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! > > ! Example 4 > ! array pointer vs scalar target > program p >   real, target :: scalar >   real, dimension(:), pointer :: parray => null() >   print *, associated(parray, scalar) > end > > !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! > > ! Example 5 > ! scalar pointer vs array target > program p >   real, dimension(100), target :: array >   real, pointer :: pscalar => null() >   print *, associated(pscalar, array) > end > > !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! > > ! Example 6 > ! assumed rank (array) pointer vs matrix target > program p >   real, dimension(20,5), target  :: matrix >   real, dimension(:),    pointer :: parray => null() >   call sub(parray) > contains >   subroutine sub(ptr) >     real, pointer :: ptr(..) >     print *, associated(ptr, matrix) >   end subroutine sub > end > > !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! > > ! Example 7 > ! assumed rank (scalar) pointer vs array target > program p >   real, dimension(100), target :: array >   real, pointer :: pscalar => null() >   call sub(pscalar) > contains >   subroutine sub(ptr) >     real, pointer :: ptr(..) >     print *, associated(ptr, array) >   end subroutine sub > end > > !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! > > ! Example 8 > ! assumed rank (array) pointer vs scalar target > program p >   real, target :: scalar >   real, dimension(:), pointer :: parray => null() >   call sub(parray) > contains >   subroutine sub(ptr) >     real, pointer :: ptr(..) >     print *, associated(ptr, scalar) >   end subroutine sub > end > > !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -- Toon Moene - e-mail: toon@moene.org - phone: +31 346 214290 Saturnushof 14, 3738 XG Maartensdijk, The Netherlands