Le 25/07/2022 à 18:01, Harald Anlauf a écrit :
Hi Mikael, all,
a discussion in the Intel compiler forum suggests that the F2018
standard prohibits such use of the ASSOCIATED intrinsic.
https://community.intel.com/t5/Intel-Fortran-Compiler/Intel-rejects-ASSOCIATED-pointer-target-for-non-equal-ranks/m-p/1402799/highlight/true#M162159
I disagree with the conclusion. Quoting Steve Lionel’s post:
What you're missing is this:
TARGET (optional) shall be allowable as the data-target or proc-target in a
pointer assignment statement (10.2.2) in which POINTER is data-pointer-object
or proc-pointer-object.
We then go to 10.2.2 which says (emphasis mine):
C1019 (R1033) If bounds-remapping-list is not specified, the ranks of
data-pointer-object and data-target shall be the same.
So... not valid Fortran 2018.
except, that there is also this:
C1018 (R1033) If bounds-remapping-list is specified, the number of
bounds-remappings shall equal the rank of data-pointer-object.
which practically imposes no conformance rule between
data-pointer-object and data-target.
Note that in the syntax definition, bounds-remapping-list is not part of
data-pointer-object. In other words, by collating a
bounds-remapping-list next to POINTER, one can construct an allowable
pointer assignment from TARGET to POINTER, which satisfies the
requirement, even if TARGET and POINTER don’t have the same rank.