[J3] Is this legal in F202X? Rank agnosticism and scalars
Tom Clune
tlclune at gmail.com
Tue Jan 24 23:31:45 UTC 2023
Gah! This was the original message I “sent” yesterday. Apparently it was sitting on my home machine waiting for me to log in again.
Sorry for the ongoing out-of-order-confusion.
> On Jan 23, 2023, at 7:17 PM, Tom Clune <tlclune at gmail.com> wrote:
>
> Hi Vipul,
>
> It does not reduce to _either_ of the snippets you provide. When N is zero, A is a _scalar_. So it reduces to
>
> REAL, INTENT(IN) :: A
> INTEGER :: IDX(0)
> IDX = 1
> PRINT*, A(@idx)
>
> In your cases, A is a RANK 1 array of size 0. As such it requires a size 1 multi subscript, but your code only has a size 0 multisubscript. Thus both of your examples are nonconforming.
>
> There is another constraint that basically says the ranks of the subscripts must add up to th rank of the array. Too tired to go find it just now.
>
> Cheers,
>
> _ Tom
>
>> On Jan 23, 2023, at 7:05 PM, Vipul Parekh via J3 <j3 at mailman.j3-fortran.org> wrote:
>>
>>
>>
>> On Mon, Jan 23, 2023 at 2:09 PM Clune, Thomas L. (GSFC-6101) via J3 <j3 at mailman.j3-fortran.org <mailto:j3 at mailman.j3-fortran.org>> wrote:
>>> .. Is the PRINT statement above legal? ..
>>>
>>
>> Hi Tom,
>>
>> Does the code you show reduce to the following?
>> integer :: a(0)
>> integer :: idx(0)
>> a = 42
>> idx = 1
>> print *, a( idx ), "; expected is ?"
>> end
>>
>> or
>> integer :: a(0)
>> integer :: idx(0)
>> a = 42
>> idx = 1
>> print *, a( @idx ), "; expected is ?"
>> end
>>
>> Do you think constraint C825 toward the array option to specify multiple subscripts starting Fortran 2023 covers both the cases above?
>>
>> To me, it is unclear what the standard states with the first case above. It appears the first case is nonconforming but there is no numbered constraint for it specifically to detect and report that.
>>
>> Thanks,
>> Vipul
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20230124/bc7a70d8/attachment-0001.htm>
More information about the J3
mailing list