From: Toon Moene <toon@moene.org>
To: Mikael Morin <morin-mikael@orange.fr>,
Harald Anlauf <anlauf@gmx.de>,
fortran@gcc.gnu.org
Subject: Re: [PATCH, v2] Fortran: fix invalid rank error in ASSOCIATED when rank is remapped [PR77652]
Date: Sat, 30 Jul 2022 16:13:08 +0200 [thread overview]
Message-ID: <48bb1d77-182d-cd8c-1ff9-047a9c5755c9@moene.org> (raw)
In-Reply-To: <f2bce896-b3ef-b4c6-3267-ba870912849a@orange.fr>
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
next prev parent reply other threads:[~2022-07-30 14:36 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-21 20:12 [PATCH] " Harald Anlauf
2022-07-25 10:43 ` Mikael Morin
2022-07-25 16:01 ` Harald Anlauf
2022-07-25 18:08 ` Mikael Morin
2022-07-25 20:18 ` Harald Anlauf
2022-07-26 19:25 ` Mikael Morin
2022-07-27 19:45 ` [PATCH, v2] " Harald Anlauf
2022-07-27 19:45 ` Harald Anlauf
2022-07-27 19:50 ` Toon Moene
2022-07-28 20:19 ` Mikael Morin
2022-07-29 20:01 ` Harald Anlauf
2022-07-29 20:01 ` Harald Anlauf
2022-07-30 10:03 ` Mikael Morin
2022-07-30 14:13 ` Toon Moene [this message]
2022-07-30 18:35 ` Harald Anlauf
2022-07-30 18:35 ` Harald Anlauf
2022-08-04 12:03 ` Mikael Morin
2022-08-18 19:32 ` Harald Anlauf
2022-08-18 19:32 ` Harald Anlauf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48bb1d77-182d-cd8c-1ff9-047a9c5755c9@moene.org \
--to=toon@moene.org \
--cc=anlauf@gmx.de \
--cc=fortran@gcc.gnu.org \
--cc=morin-mikael@orange.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).