To: J3 J3/15-164r1 Subject: Constraint C411 on TYPE(*) does not admit scalars From: Van Snyder Reference: 15-007r1 Date: 2015 June 18 1. Introduction =============== Subclause 5.5.8.7p1 explicitly allows the effective argument associated with an assumed-rank dummy argument to be a scalar: "this rank can be zero." Therefore, a scalar assumed-type actual argument should be allowed to correspond to an assumed-rank dummy argument. C411 says that an assumed-type actual argument that corresponds to an assumed-rank dummy argument shall be assumed-shape or assumed-rank. "Scalar" is conspicuously absent. This inconsistency should be corrected. An assumed-rank dummy argument clearly has enough of a descriptor that the RANK intrinsic function can be executed with that dummy argument as its argument. Indeed, the introduction of assumed rank was the only reason to introduce the RANK intrinsic function, and therefore it was clearly contemplated that assumed-rank dummy arguments would have descriptors. Subclause 12.4.2.2p1(2)(c) requires a procedure to have explicit interface if it has an assumed-rank dummy argument. Therefore, where it is invoked, the processor is necessarily aware that a constructor is required for an actual argument that corresponds to an assumed-rank dummy argument. There are two relevant possibilities concerning the corresponding dummy argument: It is or it is not an assumed-rank object. If it is not an assumed-rank object, its rank is evident from the syntax of its declaration and the declarations of its attributes, or it is a scalar if it is not explicitly declared to have the DIMENSION attribute. If it is an assumed-rank object, it is an assumed-rank dummy argument, and therefore has a descriptor. A simple induction proves that its descriptor has a value for its rank, and therefore the processor can produce a descriptor that includes its rank, for its use as an actual argument. The conditions that allow to compute the rank of an actual argument that corresponds to an assumed-rank dummy argument are independent of whether the type is or is not assumed, and independent of whether the actual argument is a scalar, an assumed-shape array, or an assumed-rank array. Therefore, this inconsistency can be corrected. The reason that C411 does not admit explicit-shape arrays of assumed type to be actual arguments that correspond to assumed-rank dummy arguments is that the processor does not know the element size of assumed-type objects. This is prohibited by C409, but could equally have been a constraint on C516. An assumed-type object cannot have explicit shape, and the only other possibilities are that is a scalar, of assumed shape, or of assumed rank. Therefore, C411 could be simplified to "An assumed-type actual argument that corresponds to an assumed-rank dummy argument shall not be an explicit-shape array." This is, however, already probited by C409 for all assumed-type objects, not just ones that are actual arguments that correspond to assumed-rank dummy arguments. Therefore C411 isn't really necessary. 2. Edits ======== [54:18 C411] Before "assumed-shape" insert "a scalar, or an". After "assumed-rank" insert "array", making the sentence end "... shall be a scalar, or an assumed-shape or assumed-rank array." {C411 came from C407c in subclause 9.4 on page 34 of N1904, TS 29113, "Further Interoperability of Fortran with C." We don't do interps or publish corrigenda on Technical Specifications. This difference from TS 29113 should be brought to the reader's attention: [xviii Introduction under "Data usage and computation"] Insert a sentence: "An assumed-type actual argument that corresponds to an assumed-rank dummy argument is allowed to be a scalar; assumed type and assumed rank were introduced in ISO/IEC TS 29113, not ISO/IEC 1539-1:2010." 2. First alternative edits ========================== [54:17-18 C411] Replace C411: "C411 An assumed-type actual argument that corresponds to an assumed- rank dummy argument shall not be an explicit-shape array." {C411 came from C407c in subclause 9.4 on page 34 of N1904, TS 29113, "Further Interoperability of Fortran with C." We don't do interps or publish corrigenda on Technical Specifications. This difference from TS 29113 should be brought to the reader's attention: [xviii Introduction under "Data usage and computation"] Insert a sentence: "An assumed-type actual argument that corresponds to an assumed-rank dummy argument is allowed to be a scalar; assumed type and assumed rank were introduced in ISO/IEC TS 29113, not ISO/IEC 1539-1:2010." 3. Second alternative Edits =========================== [54:17-18 C411] Delete constraint C411. {C411 came from C407c in subclause 9.4 on page 34 of N1904, TS 29113, "Further Interoperability of Fortran with C." We don't do interps or publish corrigenda on Technical Specifications. This difference from TS 29113 should be brought to the reader's attention: [xviii Introduction under "Data usage and computation"] Insert a sentence: "An assumed-type actual argument that corresponds to an assumed-rank dummy argument is allowed to be a scalar; assumed type and assumed rank were introduced in ISO/IEC TS 29113, not ISO/IEC 1539-1:2010."