To: J3 J3/21-134 From: Malcolm Cohen Subject: Interp F18/019 PURE and default initialization Reference: 20-151 Date: 2021-March-15 ---------------------------------------------------------------------- NUMBER: F18/026 TITLE: C_SIZEOF argument DEFECT TYPE: Erratum STATUS: J3 consideration in progress QUESTION: Consider the example SUBROUTINE test(b) USE iso_c_binding REAL(c_double) b(:),a(SIZE(b)) PRINT *,c_sizeof(a) ! A PRINT *,c_sizeof(b) ! B PRINT *,c_sizeof(a(::2)) ! C PRINT *,c_sizeof(a+1) ! D PRINT *,c_sizeof(1.0_c_double) ! E END SUBROUTINE 18.2.3.7 C_SIZEOF (X) states "X shall be an interoperable data entity..." According to that, the reference to C_SIZEOF marked A is valid, as A is interoperable (an explicit-shape array of interoperable type and type parameters). And the reference marked B is invalid, as only explicit-shape arrays and assumed-size arrays are interoperable, thus assumed-shape arrays are definitely not. For the references at C and D, the standard seems to be silent on the matter of whether they are interoperable. It is clear for named variables, but although subobject designators can denote variables, they are not names, and expressions are not variables at all. Being silent implies non-conformance as no interpretation is established. The reference at E also appears to be non-conforming, as the standard specifies no criteria for interoperability of expressions. However, the description of the result of C_SIZEOF only makes use of the interoperability of the type and type parameters. Are these references intended to be conforming? If not, should the standard be clarified to say that X shall be an interoperable named variable? ANSWER: Yes, these references were all intended to be conforming. An edit is supplied to correct this mistake. ALTERNATIVE ANSWER: No, only the reference marked A is valid. An edit is supplied to clarify the situation. EDIT to 18-007r1: [473:27] 18.2.3.7 C_SIZEOF (X), p3 Argument, Change "an interoperable data entity that is not" to "of interoperable type and type parameters, and shall not be", making the whole paragraph read: "Argument. X shall be of interoperable type and type parameters, and shall not be an assumed-size array or an assumed-rank array that is associated with an assumed-size array." {Loosen the requirements.} ALTERNATIVE EDIT to 18-007r1: [473:27] 18.2.3.7 C_SIZEOF (X), p3 Argument, Change "an interoperable data entity" to "a named interoperable variable", making the whole paragraph read: "Argument. X shall be a named interoperable variable that is not an assumed-size array or an assumed-rank array that is associated with an assumed-size array." {Clarify the requirements.} SUBMITTED BY: Malcolm Cohen HISTORY: 21-nnn m224 Submitted ----------------------------------------------------------------------