To: J3 J3/14-149r1 From: R. Bader Subject: Amendments to TS 29113 Date: 2014 June 19 References: N1942, N2014 Based on implementation experience by Tobias Burnus and further comments by Daniel Chen, Bill Long and others, this paper suggests amendments to TS 29113. It is an updated version of 13-261. Edits are written against N2014 (14-007r1). (A) Assumed rank entities ~~~~~~~~~~~~~~~~~~~~~~~~~ The Fortran lower bounds of an assumed-rank dummy argument that does not have the POINTER or ALLOCATABLE attribute should be one; some words on bounds and extents are missing for assumed-rank entities. Furthermore, C533 must be loosened in order to allow assumed-rank entities to have the POINTER or ALLOCATABLE attribute. EDITS: [97:29] after "ALLOCATABLE attribute" add " that is not an assumed-rank entity (5.3.8.7)" [99:20+] After C540, add a new paragraph at the end of 5.3.8.7 "The lower bounds of an assumed-rank entity that does not have the POINTER or ALLOCATABLE attribute and is of rank larger than zero are 1; its extents and upper bounds are determined as if it were an assumed-shape array (5.3.8.3). The size, bounds and shape of an assumed-rank entity that has the POINTER or ALLOCATABLE attribute and is of rank larger than zero are determined as if it were a deferred-shape array (5.3.8.4)." [[For a corresponding C descriptor, [442:42] already specifies the lower bounds for a non-allocatable non-pointer array as zero.]] (B) Descriptors for assumed size objects ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Descriptors for assumed size objects according to section 15.5.2 have a dim[].extent value of -1. For some of the functions from section 15.5.5, it is unclear to which extent such descriptors can appear as parameters. In detail, (B.1) CFI_address ~~~~~~~~~~~~~~~~~ From the present definition, no valid subscripts[] argument can be specified for an assumed-size object. This is too draconian. EDITS: [447:1-2] Replace "The value of" by "For between 1 and - 1, the value of" [447:2+] Add "The value of subscripts[n] shall be greater than or equal to that of the lower bound of dimension specified by the dim member of the C descriptor." [[The last paragraph of 15.7 provides the additional necessary restriction that renders any kind of overindexing that may otherwise happen non-conforming.]] (B.2) CFI_select_part ~~~~~~~~~~~~~~~~~~~~~ The /source/ parameter is presently permitted to be an assumed-size object, resulting in assumed-size subobjects that are in general non-contiguous. This must be prohibited. EDIT: [452:7] After "nonallocatable nonpointer array", add " that is not assumed-size". (B.3) CFI_setpointer ~~~~~~~~~~~~~~~~~~~~ The /source/ parameter is presently permitted to be an assumed-size object. This must be prohibited. EDIT: [453:4] After "nonallocatable nonpointer data object", add " that is not an assumed-size array". (B.4) Assumed shape dummy matching ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ An assumed-size object must not appear as an actual argument associated with an assumed-shape dummy. 12.5.2.4 para 14 specifies this for Fortran, but I consider it useful to add text that confirms this for the interoperation case. EDIT: [453:34-] At the end of 15.6, add the following text "Because an assumed-size object is prohibited from appearing as an actual argument associated with an assumed-shape dummy argument (12.5.2.4), a descriptor for an assumed-size object is not permitted to appear as an actual parameter corresponding to an assumed shape dummy argument." (C) Descriptor updates not uniquely defined ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ For the functions CFI_section and CFI_select_part, it is not clear how the /lower_bound/ values are set. It is suggested to retain the pre-existing values. (C.1) CFI_section EDITS: [450:27] Replace "Successful execution ... dim members" by "Successful execution of CFI_section updates the /base_addr/ and the /extent/ and /sm/ members for each array dimension". The Example Case(ii) needs some minor fixes: [451:32,33,35] Replace ".lower" by ".lower_bound", thrice. (C.2) CFI_select_part EDITS: [452:16]: Replace the sentence "Successful execution ... members" by "Successful execution of CFI_select_part updates the /base_addr/ member, the /extent/ and /sm/ members for each array dimension and, in case /result->type/ specifies a Fortran character type, the /elem_len/ member" (D) Allow scalars to be argument associated with assumed-size TYPE(*) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This has been dealt with via 13-283. However I suggest a change to an example in Annex C.11.7: EDITS: [542:8] replace "[ z ]" by "z". [542:9-10] replace ", but it is necessary ... pass it" by "; the scalar z is treated as if it were a sequence associated array of size one." (E) Token for assumed-rank entities. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The sequence of two dots should be listed as a token in section 3.2.1 of the Fortran standard, to prevent a declaration of the form real, dimension(. .) :: a EDIT: [44:10] After ";", add ", .."