[J3] Passing an element of an assumed shape array to an assumed size dummy array
Pierre Hugonnet
pieru at ugo235.fr
Mon May 12 09:40:47 UTC 2025
There are actually cases where passing an element and counting on
sequence association is still useful, and where passing an array section
instead would result in copy-in/copy-out, thus hurting the performances.
I have given an example here:
https://fortran-lang.discourse.group/t/array-element-actual-argument-assumed-size-dummy/9649/3?u=pieru
Pierre
Le 11.05.2025 21:22, Van Snyder via J3 a écrit :
> On Sat, 2025-05-10 at 21:07 -0700, Robert Corbett via J3 wrote:
>
>> There is no incompatibility with FORTRAN 66 or FORTRAN 77. The restriction on passing a scalar actual argument to an array dummy arguments applies only to assumed-shape, pointer, or polymorphic arrays (see the first dotted item in paragraph 14 of Subclause 15.5.2.5). Therefore, the only incompatibility with FORTRAN 66 or FORTRAN 77 codes is with FORTRAN 66 or FORTRAN 77 codes that include assumed-shape, pointer, or polymorphic arrays.
>
> Would it be useful to carve out an exception to use an element of a contiguous assumed-shape array (or pointer) as the start of a sequence association?
>
> Probably not, because the actual argument is necessarily in a scope using stuff from Fortran 90 onward so there's no excuse not to write x(10:).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20250512/870c1c2a/attachment.htm>
More information about the J3
mailing list