[J3] RANK clause
Robert Corbett
rpcorbett at att.net
Mon Jun 16 03:55:24 UTC 2025
I think there is a problem. the first sentence of subclause 8.5.17 states
An entity declared with a RANK clause has the specified rank.
In my example, the RANK clause specifies rank 0, but the entity decl specifies that the entity has rank 1.
Bob Corbett
> On Jun 15, 2025, at 3:14 PM, John Reid via J3 <j3 at mailman.j3-fortran.org> wrote:
>
> Robert Corbett via J3 wrote:
>> A related case might be interesting. The standard appears to allow
>>
>> REAL, RANK(0) :: X4(4)
>>
>> I do not know if that was intended.
>
> This is allowed by 8.2:
> "The type declaration statement also specifies the attributes whose keywords appear in the attr-spec, except that
> the DIMENSION attribute can be specified or overridden for an entity by the appearance of array-spec in its
> entity-decl, and ..."
>
> I do not see any problem with this.
>
> John.
>>
>> Bob Corbett
>>
>>>> On Jun 15, 2025, at 10:18 AM, Robert Corbett via J3 <j3 at mailman.j3-fortran.org> wrote:
>>>
>>> Constraint C815 appears to cover this case. Both the DIMENSION attr-spec and the RANK clause specify the DIMENSION attribute of an entity.
>>>
>>> The constraint you suggest might add clarity and consistency, but it seems to be an editorial change.
>>>
>>> Bob Corbett
>>>
>>>> On Jun 15, 2025, at 7:20 AM, John Reid via J3 <j3 at mailman.j3-fortran.org> wrote:
>>>>
>>>> Dear all,
>>>>
>>>> For a type declaration statement (R801) we have this constraint
>>>>
>>>> C801 (R801) The same attr-spec shall not appear more than once in a given type-declaration-stmt.
>>>>
>>>> However we have added the rank-clause, which specifies the DIMENSION attribute.(8.1.17). Does this not mean that we need a constraint such as
>>>>
>>>> C8xx A rank-clause shall not appear in a type-declaration-stmt that has a DIMENSION clause.
>>>>
>>>> Or have I missed something?
>>>>
>>>> Here is an example that should be noticed as an error at compile time, IMHO
>>>>
>>>> real, rank(3), dimension(10) :: a
>>>>
>>>> Cheers,
>>>>
>>>> John.
>
More information about the J3
mailing list