ISO/IEC JTC1/SC22/WG5-N1865 Documentation of changes between N1854 and N1866 July 6, 2011 Bill Long Resolution Resolution G7 in ISO/IEC JTC1/SC22/WG5-N1861 directs the editor for TR 29113 to produce an updated version of the TR draft based on the cited PL22.3 papers. This document contains details on the process to produce the updated version, which is document ISO/IEC JTC1/SC22/WG5-N1866. Part 1: Summary of papers: ========================== Edits from the following PL22.3 papers were used in converting N1854 into N1866. For details on changes noted, see the corresponding edits in Part 2. 11-159r1 11-160r1 - additional edit added for [33:32-33]. 11-161 11-162r1 11-163r1 11-164r1 11-165r1 11-166r2 11-167r2 - edit at [15:32-35] overridden by 225r1. edit at [19:33-44] modified to avoid ambiguous wording that was removed in other locations. 11-168r2 - edit at [16:15-16] overridden by edit [16:14-18] in 211r1. edit at [16:17] overridden by edit [16:14-18] in 211r1. in edit [16:30-45] changed "Example 2:" to "Example 2.". edit at [17:12-15] overridden by edit [17:12-15] in 211r1. edit at [19:12] overridden by edit [19:12] in 167r2. removed extra comma from edit at [38:5]. edit at [38:32+] moved to [38:35+] assumed edit at [39:26-31] meant to delete the lines although it didn't actually say so. in edit [40:36+] corrected missing return value. 11-173r1 - added an edit at [10:12] to account for new type code. added an edit at [16:7] to account for the new type code. 11-175r2 - added edit at [17:12] to restore attribute restrictions. modified edit at [17:19-24] to correct stride units. assumed that only part of the Example is replaced by edit at [17:34-18:2], and modified the comment lines. 11-178r2 11-202r2 11-208r1 - added edit at [18:9] to restore attribute restrictions. modified edit at [18:28-29] to remove text now in the result argument description. edit at [18:30-31] overridden by edit [18:30-31] in 11-220. edit at [18:31] overridden by edit [18:30-31] in 11-220. 11-209 11-210r1 11-211r1 11-220 - added edit at [17:9] to remove reference to 'establish'. modified edit at [17:25] to correct inconsistent word ordering. added edit at [18:6] to remove reference to 'establish'. modified edit at [18:26] to create consistent sentence structure. 11-225r1 In addition to added edits noted above in relation to specific papers, more edits were added at the following locations. See the list of all edits in Part 2 for details. Edits added at: [5:7] - explicit interface for assumed-type. [6:3] - missing KIND in LBOUND. [11:4,5] - change "descriptor" to "C descriptor" [28:1-2] - missing KIND in LBOUND (Clause 6 edit for [6:3]). [28:37+] - additional processor dependencies for F08 Annex A. [29:1,2] - adjust subclause numbers. [31:21] - adjust subcaluse numbers. Part 2: List of edits: ====================== Following is the list of edits applied to N1854, in document order. The edits are extracted from the papers listed in Part 1, labeled with the paper number in { }, and other edits required to resolve conflicts, labeled with a comment of the form {Editor: ...}. General ------- {11-167r2} {Editor: Global document edit; each instance will be noted. Final "q" ignored. Since the wording used in the C standard is "a null pointer", that case will be used in the edits.} All TR: Throughout the TR, replace "NULL" with "a NULL pointer" except in code examples and elsewhere NULL is needed.q Changes made at: [9:36] twice. [12:5+] in Table 5.3 Error descriptions, first 4 lines. [14:8+] in Note 5.6 [16:1] in the description of base_addr (twice). [16:4-5] in the description of attribute. [16:12-13] in the description of extents. [16:16] in description of CFI_establish. [16:21+] in new Note, change "equal to NULL" to "a null pointer". [16:19+] in the new lower_bounds description. [16:19+] in the new upper_bounds description. [16:19+] in the new strides description. [19:11] in the description of source. [19:13] in the description of lower_bounds. [19:19,22] in discussion of source. [21:7] change "with the value NULL" to ""with the value of a null pointer". [28:34] same edit as for [21:7]. 2. Type specifiers and attributes --------------------------------- {11-202r2} [4:28+] After NOTE 2.4, add new section ``2.4 ASYNCHRONOUS attribute 2.4.1 Introduction The ASYNCHRONOUS attribute is extended to apply to variables that are used for asynchronous communication initiated and completed by procedures written in C. 2.4.2 Asynchronous communication Asynchronous communication for a Fortran variable occurs through the action of procedures defined by means other than Fortran. It is initiated by execution of an asynchronous communication initiation procedure and completed by execution of an asynchronous communication completion procedure. Between the execution of the initiation and completion procedures, any variable of which any part is associated with any part of the asynchronous communication variable is a pending communication affector. Whether a procedure is an asynchronous communication initiation or completion procedure is processor dependent. Asynchronous communication is either input communication or output communication. For input communication, a pending communication affector shall not be referenced, become defined, become undefined, become associated with a dummy argument that has the VALUE attribute, or have its pointer association status changed. For output communication, a pending communication affector shall not be redefined, become undefined, or have its pointer association status changed.'' 3.2 Explicit interface ---------------------- {Editor: The current text in 3.2 says it is "additional" that an explicit interface is required for an assumed-type or assumed-rank dummy argument. However, in Clause 6 there is only an edit for assumed-rank. That is because assumed-type is polymorphic, and hence already covered by the existing F08 text. So the "assumed-type" is not "additionally to the rules of subclause 12.4.2.2". Deleting the assumed-type reference would make the statement factually correct. [5:7] Delete "assumed-type or" and add a Note: "Note 3.1 An explicit interface is also required for a procedure if it has a dummy argument that is assumed-type because an assumed-type dummy argument is polymorphic." 3.4 Intrinsic procedures ------------------------ {11-209} [5:27] "SIZE(ARRAY, I)" -> "SIZE(ARRAY, I, KIND)". append to paragraph "with KIND omitted from SIZE if it was omitted from SHAPE.". {Normative text missing the optional KIND argument. Missing full stop at end of paragraph.} {11-209} [5:32] "SIZE(ARRAY, I)" -> "SIZE(ARRAY, I, KIND)". {Normative test missing the optional KIND argument.} {Editor: The same optional KIND argument is missing from the LBOUND reference in 3.4.3.} [6:3] "LBOUND(ARRAY, RANK(ARRAY))" -> "LBOUND(ARRAY, RANK(ARRAY), KIND)". append to end of sentence: "with KIND omitted from LBOUND if it was omitted from UBOUND" 5. Interoperability with C -------------------------- {11-210r1} [9:2-] Insert new clause 5.1, renumbering the existing 5.1 to 5.2 and the existing 5.2 to 5.3, including any reference to 5.2. "5.1 Removed restrictions on C_F_POINTER and C_LOC The subroutine C_F_POINTER from the intrinsic module ISO_C_BINDING has the restriction in ISO/IEC 1539-1:2010 that if FPTR is an array, it must be of interoperable type. The function C_LOC from the intrinsic module ISO_C_BINDING has the restriction in ISO/IEC 1539-1:2010 that if X is an array, it must be of interoperable type. These restrictions are removed." 5.2.1 Summary of contents (in 5.2 ISO_Fortran_binding.h) -------------------------------------------------------- {11-163r1} [9:10] Before "functions" add "macro and". 5.2.3 CFI_cdesc_t ----------------- {11-162r1} [10:2] After "first element" add "in Fortran array element order (6.5.3.2 of ISO/IEC 1539-1:2010)". {11-163r1} [10:7] Append "when the descriptor is established and otherwise not changed." {Editor: Missing edits in 11-173r1 at [10:12] for new type codes.} [10:12] Replace "A specifier is also" by "Specifiers are also" and replace "a struct type" by "an interoperable struct type". {11-159r1} [10:30-32] Replace 5.2.3 CFI_cdesc_t para 4 with: "In a descriptor of an assumed-size array, the extent member of the last element of the dim member has the value -2." 5.2.4 Macros ------------ {Editor: Since this is a new subclause, be more specific about what kind of descriptor is created by the CFI_CDESC_T macro.} [11:4-5] Replace "descriptor" by "C descriptor" twice. {11-173r1} [11:16] In the second sentence of 5.2.4 Macros para 7, after "shall be" insert " negative and" {11-173r1} [11:17] After "specifiers." add a new sentence: "CFI_type_struct specifies a C struct that is interoperable with a Fortran derived type; its value shall be positive and distinct from all other type specifiers." {11-173r1} [11:18+] Add a new paragraph following para 7 of 5.2.4 Macros: "Additional nonnegative processor-dependent type specifier values may be defined for Fortran intrinsic types that are not represented by other type specifiers and noninteroperable Fortran derived types that do not have type parameters, type-bound procedures, final procedures, nor components that have the ALLOCATABLE or POINTER attributes, or correspond to CFI_type_other." {11-161} [12:Table 5.2] Add a new Macro | C type pair following CFI_type_intptr_t | intptr_t: "CFI_type_ptrdiff_t | ptrdiff_t" {11-173r1} [12:Table 5.2] Before then entry for CFI_type_other, add a new line: "CFI_type_struct interoperable struct" {11-173r1} [12:Table 5.2] Replace the C Type entry for CFI_type_other with: "Not otherwise specified" 5.2.5.1 General (in 5.2.5 Functions) ------------------------------------ {11-163r1} [13:3] Before "functions", add "macro and". {11-167r2} [13:8+] Move para 2 of 5.2.6 [19:36-38] to here. {11-167r2} [13:8++] Add the paragraph following the one moved by the previous edit: "The following restrictions apply if an object is pointed to by a formal parameter or actual argument that corresponds to a nonpointer dummy argument in a BIND(C) interface: * it shall not be modified if the Fortran dummy argument has the INTENT(IN) attribute; * it shall not be accessed before it is given a value if the Fortran dummy argument has the INTENT(OUT) attribute." 5.2.5.3 CFI_allocate -------------------- {11-168r2} [14:27-29] Delete "CFI_type_other or" and "If the type is CFI_type_other, elem_len shall be greater than zero and equal to the sizeof() of an element of the object." 5.2.5.5 CFI_establish --------------------- {11-168r2} [15:29] Replace "const CFI_dim_t dim[]" by "const CFI_index_t extents[]" {11-167r2} {Editor: overridden by next edit - this edit not done.} [15:32-35] Replace: "It shall not point to a C descriptor that describes an object that is described by a C descriptor pointed to by a formal parameter that corresponds to a Fortran dummy argument." by "It shall not point to a C descriptor that is pointed to by a formal parameter that corresponds to a Fortran actual argument." {11-225r1} [15:32-35] In the replacement text of the edits {Editor: from 11-167r2} to [15:32-35], replace: "It shall not point to a C descriptor that is pointed to by a formal parameter that corresponds to a Fortran actual argument." by: "It shall not point to a C descriptor that is pointed to by either a C formal parameter that corresponds to a Fortran actual argument or a C actual argument that corresponds to a Fortran dummy argument." {11-168r2} {Editor: changed "which" to "that" in the edit.} [16:1] After "not NULL it shall be" insert " a pointer to a contiguous storage sequence which is" {11-168r2} [16:3-4] Delete "If it is ... shall not be NULL" {Editor: Missing edit in 11-173r1: By introducing CFI_type_struct, there are now two type codes for which an element length is unknown, apart from assumed character length. The elem_len section of CFI_establish requires a corresponding modification.} [16:7] Replace the first "CFI_type_other" by "CFI_type_struct, CFI_type_other," and replace the second "CFI_type_other" by "CFI_type_struct or CFI_type_other". {11-168r2} [16:12-13] Replace the paragraph by "/extents/ is ignored if the rank /r/ is zero or if base_addr is NULL. Otherwise, it shall point to an array with /r/ elements specifying the corresponding extents of the described array." {11-211r1} {Editor: The Note was moved to later in the subclause. Changed "which" to "that" in line 4 of the edit.} [16:14-18] Replace the whole paragraph by "CFI_establish establishes a C descriptor for an assumed-shape array, an assumed character length object, unallocated allocatable object, or a data pointer. If base_addr is not NULL, it is for a nonallocatable entity which is a scalar or a contiguous array. If base_addr is NULL, the established C descriptor is for an unallocated allocatable, a disassociated pointer, or is a C descriptor that has the attribute CFI_attribute_assumed but does not describe a Fortran assumed shape array. The properties of the object are given by the other arguments. Note 5.6+: A descriptor with attribute CFI_attribute_assumed and base_addr equal to NULL can be used as the argument /result/ in calls to CFI_section or CFI_select_part, which will produce a descriptor for a Fortran assumed shape array." {This also subsumes the changes in this paragraph from 11-168r1}. {11-168r2} {Editor: overridden by 11-211r1 edit - this edit not done.} [16:15-16] Delete the sentence "If base_addr ... subobject of it". {11-168r2} {Editor: overridden by 11-211r1 edit - tis edit not done.} [16:17] After "disassociated pointer" add "; otherwise, it is for a non-allocatable entity which is a scalar or a contiguous array." {11-163r1} [16:18+] Add a new paragraph: "It is unspecified whether CFI_establish is a macro or an identifier declared with external linkage. If a macro definition is suppressed in order to access an actual function, the behavior is undefined." {11-167r2} [16:19] Change "to the C descriptor established" to "to an established C descriptor". {11-168r2} {Editor: Order of the next 2 edits was not specified.} [16:21+] Add the following text: "NOTE 5.6+ CFI_establish is used to initialize the descriptor declared in C with CFI_CDESC_T before passing it to any other functions as an actual argument, in order to set the rank, attribute, type and element length." {11-163r1} [16:21+] Add a new note: "NOTE 5.x This function is allowed to be a macro to provide extra implementation flexibility. For example, it could include the value of CFI_VERSION in the header used to compile the call to CFI_establish as an extra argument of the actual function used to establish the descriptor." {11-168r2}{Editor: Changed "Example 2:" to "Example 2." Changed "subprogram which" to "subprogram that". Hyphenated "assumed shape". Rearranged final call to fit on 2 lines.} [16:30-45] Replace text by: "Example 2: Given the Fortran type definition type, bind(c) :: t real(c_double) :: x complex(c_double_complex) :: y end type and a Fortran subprogram which has an assumed shape dummy argument of type t, the following code fragment creates a descriptor /a_fortran/ for an array of size 100 which can be used as the actual argument in an invocation of the subprogram from C: typedef struct {double x; double _Complex y;} t; t a_c[100]; CFI_CDESC_T(1) a_fortran; int ind; CFI_index_t extent[1]; extent[0] = 100; ind = CFI_establish( (CFI_cdesc_t *) &a_fortran, a_c, CFI_attribute_assumed, CFI_type_struct, sizeof(t), 1, extent);" 5.2.5.6 CFI_is_contiguous ------------------------- {11-159r1} [17:6+] Add the following note: "Note 5.6+: A C descriptor whose attribute member has the value CFI_attribute_unknown_size or CFI_attribute_allocatable always describes a contiguous object." 5.2.5.7 CFI_section ------------------- {11-175r2} [17:7-8] Delete "CFI attribute t attribute," and replace "const CFI_dim_t dim[]" by "const CFI_index_t lower_bounds[], const CFI_index_t upper_bounds[], const CFI_index_t strides[]". {Editor: Edit missing in 11-220 to remove "establish" from the Description of CFI_section.} [17:9] Replace "Establishes" by "Updates". {11-220} [17:12] Delete "a C object large enough to hold" {Editor: When 11-175r2 deleted the attribute member, the restriction that the result had to be assumed-shape or pointer was lost. Added the restriction to the description of result.} [17:12] After the first sentence in result, add: "The attribute member shall have the value CFI_attribute_assumed or CFI_attribute_pointer." {11-167r2} {Editor: overridden by next edit - this edit not done.} [17:12-15] Replace: "It shall not point to a C descriptor that describes an object that is described by a C descriptor pointed to by a formal parameter that corresponds to a Fortran dummy argument. It shall not point to a C descriptor that describes an allocated allocatable object." by "If /result/ points to a C descriptor that is pointed to by a formal parameter that corresponds to a Fortran actual argument, the attribute member shall not have the value CFI_attribute_assumed." {11-225r1} [17:12-15] In the replacement text of the edits {Editor: from 11-167r2} to [17:12-15], replace: "If /result/ points to a C descriptor that is pointed to by a formal parameter that corresponds to a Fortran actual argument, the attribute member shall not have the value CFI_attribute_assumed." by: "If /result/ points to a C descriptor that is pointed to by either a C formal parameter that corresponds to a Fortran actual argument or a C actual argument that corresponds to a Fortran dummy argument, the attribute member shall have the value CFI_attribute_pointer.". {11-167r2} [17:17] At the end of the source description, add "The corresponding values of the elem_len and type members shall be the same in the C descriptors pointed to by source and result." {11-175r2} [17:18] Delete the specification of the attribute parameter. {11-175r2} {Editor: In the text for the strides argument below, the units are wrong. The current text says that the units are in elements of the argument source. But that is just a scalar pointer, not an array. In the strides paragraph, replace "argument source" by "the array described by the C descriptor pointed to by source".} [17:19-24] Replace the paragraph specifying the dim argument by: "lower_bounds points to an array specifying the subscripts of the element in the given array that is the first element, in Fortran array element order (6.5.3.2 of ISO/IEC 1539-1:2010), of the array section. If it is NULL, the subscripts of the first element of source are used; otherwise, the number of elements shall be source->rank. upper_bounds points to an array specifying the subscripts of the element in the given array that is the last element, in Fortran array element order (6.5.3.2 of ISO/IEC 1539-1:2010), of the array section. If it is NULL, the subscripts of the last element of source are used; otherwise, the number of elements shall be source->rank. strides points to an array specifying the strides of the array section in units of elements of argument source; if an element is 0, the section subscript for the dimension is a subscript and the corresponding elements of lower_bounds and upper_bounds shall be equal. If it is NULL, the strides are treated as being all 1; otherwise, the number of elements shall be source->rank." {11-220} {Editor: The following edit results in a sentence that has "argument result" and "source argument". Simplified the text by deleting the argument qualifier in both cases.} [17:25] Replace "establishes a C descriptor" by "updates the C descriptor pointed to by the argument /result/" {11-175r2}{Editor: Changed final "which" to "that".} [17:26-28] Replace "The attribute argument determines whether the C descriptor describes an assumed-shape array or pointer object. The value of result->rank is source->rank minus the number of dim entries for which the extent member is equal to -1." by "The value of result->rank is source->rank minus the number of stride elements which have value 0." {11-225r1} [17:26-28] In the last line of the edits {Editor: from 11-175r2} to [17:26-28], replace "is source->rank" by "shall be source->rank". {11-220} [17:29] Replace "object pointed to" by "C descriptor pointed to"; delete "to the C descriptor established" {11-175r2} [17:29] Replace "the C descriptor established" by "an established C descriptor". {11-220} [17:30] Replace "that object" by "that C descriptor" {11-175r2} {Editor: in the code below the comments could be misunderstood as statements about what the following C statement does, rather than instructions to establish the descriptor before calling CFI_section. Modified the comments to append "before calling CFI_section".} [17:34-18:2] Replace the example by: "the following code fragment updates a C descriptor to describe the array section A(3::5). CFI_index_t lower_bounds[] = {2}, strides[] = {5}; CFI_CDESC_T(1) section; int ind; /* Establish the C descriptor section. */ ind = CFI_section ( (CFI_cdesc_t *) §ion, source, lower_bounds, NULL, strides ); If source already points to a C descriptor for the rank-two assumed-shape array A declared in Fortran as real A(100,100) the following code fragment updates a C descriptor to describe the rank-one array section A(:,42). CFI_index_t lower_bounds[] = {source->dim[0].lower_bound,41}, upper_bounds[] = {source->dim[0].upper_bound,41}, strides[] = {1,0}; CFI_CDESC_T(1) section; int ind; /* Establish the C descriptor section. */ ind = CFI_section ( (CFI_cdesc_t *) §ion, source, lower_bounds, upper_bounds, strides ); " 5.2.5.8 CFI_select_part ----------------------- {11-208r1} [18:4] Delete "CFI_attribute_t attribute,". {11-208r1} [18:5] Delete "CFI_type_t type,". {11-220} [18:9] Delete "a C object large enough to hold" {Editor: When 11-208r1 deleted the attribute member, the restriction that the result had to be assumed-shape or pointer was lost. Added the restriction to the description of result.} [18:9] After the first sentence in result, add: "The attribute member shall have the value CFI_attribute_assumed or CFI_attribute_pointer." {11-167r2} {Editor: overridden by next edit - this edit not done.} [18:9-12] Replace: "It shall not point to a C descriptor that describes an object that is described by a C descriptor pointed to by a formal parameter that corresponds to a Fortran dummy argument. It shall not point to a C descriptor that describes an allocated allocatable object." by "If /result/ points to a C descriptor that is pointed to by a formal parameter that corresponds to a Fortran actual argument, the attribute member shall not have the value CFI_attribute_assumed." {11-225r1} [18:9-12] In the replacement text of the edits {Editor: from 11-167r2} to [18:9-12], replace: "If /result/ points to a C descriptor that is pointed to by a formal parameter that corresponds to a Fortran actual argument, the attribute member shall not have the value CFI_attribute_assumed." by: "If /result/ points to a C descriptor that is pointed to by either a C formal parameter that corresponds to a Fortran actual argument or a C actual argument that corresponds to a Fortran dummy argument, the attribute member shall have the value CFI_attribute_pointer.". {11-167r2} [18:14] At the end of the source description, add "The corresponding values of the rank member shall be the same in the C descriptors pointed to by source and result." {11-208r1} [18:15] Delete description of attribute argument. {11-208r1} [18:16] Delete description of the type argument. {11-208r1} [18:21] In the first sentence of the elem_len argument, delete "CFI_type_other or". {11-208r1} [18:21-23] In elem_len, delete the second sentence. {11-220} {Editor: removed "the argument" in this edit to be consistent with the structure of the rest of the sentence.} [18:26] Replace "establishes a C descriptor" by "updates the C descriptor pointed to by the argument /result/" {11-208r1} {Editor: removed the restriction on the attribute member here since it is now in the description of result. This makes the text parallel to that for CFI_section.} [18:28-29] Replace the last sentence of 5.2.5.8 para 3 with "In the C descriptor pointed to by result, the attribute member shall be CFI_attribute_assumed or CFI_attribute_pointer and the type member shall be the specifier for the type of the part." {11-220} [18:30-31] Replace "object pointed to" by "C descriptor pointed to"; delete "to the C descriptor established"; replace "that object" by "that C descriptor" {11-208r1} {Editor: This is overridden by the edit in 11-220 above.} [18:30-31] Replace "the object ... established" with "the C descriptor pointed to by result is updated" {11-208r1} {Editor: This is overridden by the edit in 11-220 above.} [18:31] Replace "object" with "C descriptor". {11-208r1} [19:2-4] Replace CFI_select_part call (and blank line before) with: "CFI_cdesc_t * comp_cdesc = (CFI_cdesc_t *)&component; CFI_index_t extent[] = {100}; ind = CFI_establish (comp_cdesc, NULL, CFI_attribute_assumed, CFI_type_double_complex, sizeof(double _Complex), 1, extent); ind = CFI_select_part (comp_cdesc, source, offsetof(t,y), 0);" 5.2.5.9 CFI_setpointer ----------------------- {11-168r2} [19:12] After "object.", add "Its /rank/ and /type/ members shall have the same values as that of /result/. If its type member is CFI_type_other, its /elem_len/ member shall have the same value as that of /result/." {11-167r2} {Editor: delete comma after "type".} [19:12] At the end of the source description, add "If source is not NULL, the corresponding values of the elem_len, rank, and type, members shall be in same in the C descriptors pointed to by source and result." 5.2.6 Use of C descriptors -------------------------- {Editor: Note that the text at [19:36-38] was moved to 5.2.5.1 by the edit at [13:8+].} {11-167r2} {Editor: The wording of the second sentence below was previously used in the description of the result formal parameters to CFI_section and CFI_select_part. It was seen as confusing there. Instead I substituted this replacement text suggested by Malcolm Cohen: "If a C descriptor is pointed to by a formal parameter that corresponds to a Fortran actual argument or a C actual argument that corresponds to a Fortran dummy argument, * it shall not be modified if either the corresponding dummy argument in the Fortran interface has the INTENT(IN) attribute or the descriptor is for an assumed-shape or unknown-size object, and * its base_addr member shall not be accessed before it is given a value if the corresponding dummy argument in the Fortran interface has the POINTER and INTENT(OUT) attributes." } [19:33-41] Replace the remaining contents of section 5.2.6 by: "A C descriptor shall not be initialized, updated or copied other than by calling the functions specified here. The following restrictions apply if a C descriptor is pointed to by a formal parameter or actual argument that corresponds to a dummy argument in a BIND(C) interface: * it shall not be modified if either the Fortran dummy argument has the INTENT(IN) attribute or the descriptor is for an assumed-shape or unknown-size array; * its base_addr member shall not be accessed before it is given a value if the Fortran dummy argument is a pointer and has the INTENT(OUT) attribute. NOTE: In this context, modification refers to any change to the location or contents of the descriptor, including establishment and update. The intent of these restrictions is that C descriptors remain intact at all times they are accessible to an active Fortran procedure, so that the Fortran code is not required to copy them. C programmers should note that doing things with descriptors that are not possible in Fortran will cause undefined behavior." 5.2.7 Restrictions on lifetimes ------------------------------- {11-164r1} [20:9] Replace the first sentence of paragraph 3 by: "If a pointer to a C descriptor is passed as an actual argument to a Fortran procedure, the lifetime (ISO/IEC 9899:1999 6.2.4) of the C descriptor shall not end before the return from the procedure call. If an object is passed to a Fortran procedure as a nonallocatable, nonpointer dummy argument, its lifetime shall not end before the return from the procedure call." {11-164r1} [20:12+] Add a new paragraph: "If the lifetime of a C descriptor for an allocatable object that was established by C ends before the program exits, the object shall be unallocated at that time." 5.2.8 Interoperability of procedures and procedure interfaces ------------------------------------------------------------- {11-178r2} [20:44] Delete "of interoperable type and type parameters". {11-173r1} {Editor: Add comma before "nor".} [21:4+] Add a new bullet item before the last bullet: "if the dynamic type of the effective argument is an intrinsic type with no corresponding type listed in Table 5.2, or a noninteroperable derived type that does not have type parameters, type-bound procedures, final procedures nor components that have the ALLOCATABLE or POINTER attributes, or correspond to CFI_type_other, one of the processor-dependent nonnegative type specifier values;" 6.5 Edits to clause 5 --------------------- {11-202r2} [24:23+] Add new edit ``In 5.3.4 ASYNCHRONOUS attribute, at the end of paragraph 1, insert "or asynchronous communication (15.5.4)" and at the end of paragraph 2, insert "or a pending communication affector (15.5.4)".'' 6.8 Edits to clause 13 ---------------------- {11-209} [27:1+] Insert new edit ``\hline In 13.7.90 LBOUND, insert note after paragraph 3, "NOTE 13.14a Note that if ARRAY is an assumed-rank object of rank zero, DIM cannot be present."'' {11-209} [27:18+] Insert new edit ``\hline In 13.7.156 SIZE, insert note after paragraph 3, "NOTE 13.21a Note that if ARRAY is an assumed-rank object of rank zero, DIM cannot be present."'' {11-209} [27:31+] Insert new edit ``\hline In 13.7.171 UBOUND, insert note after paragraph 3, "NOTE 13.24a Note that if ARRAY is an assumed-rank object of rank zero, DIM cannot be present."'' {Editor: Parallel to the edit in 3.4.3, add KIND arguments to UBOUND and LBOUND.} [28:1-2] "UBOUND(ARRAY, n)" -> "UBOUND(ARRAY, n, KIND)" and "LBOUND(ARRAY, n)" -> "LBOUND(ARRAY, n, KIND)". 6.9 Edits to clause 15 ---------------------- {11-210r1} [28:12+] Insert new edits ``\hline In 15.2.3.3 paragraph 3, append a new paragraph to the description of FPTR: "If the value of CPTR is the C address of a storage sequence, FPTR becomes associated with that storage sequence. If FPTR is an array, its shape is specified by SHAPE and each lower bound is 1. The storage sequence shall be large enough to contain the target object described by FPTR, shall not be in use by another Fortran entity, and shall satisfy any other processor-dependent requirements for association." \hline At the end of 15.2.3.4, insert new note "NOTE 15.xx In the case of associating FPTR with a storage sequence, there might be processor-dependent requirements such as alignment of the memory address or placement in memory." \hline In 15.2.3.6 paragraph 3, delete "scalar,".'' {11-161} [28:13-] Add a new edit to 6.9 Edits to clause 15: "{In 15.3.2 Interoperability of intrinsic types, Table 15.2, add a new Named constant / C type pair in the Fortran type = INTEGER block, following C_INTPTR_T | intptr_t, as follows} C_PTRDIFF_T | ptrdiff_t" {11-178r2} [28:31] Delete "of interoperable type and type parameters". {11-202r2} [28:37+] Add new edit ``Insert subclause 2.4.2 of this Technical Report as subclause 15.5.4 at the end of the existing subclause 15.5.'' 6.9a Edits to annex A (new subclause) ------------------------------------- {11-210r1} [28:37+] Change the 6.9a Edits to annex A subclause created by 11-202r2 as follows: Change "new bullet point" to "new bullet points", Insert another bullet point before the one in 11-202r2 "- the requirements on the storage sequence to be associated with the pointer FPTR by the C_F_POINTER subroutine;". {11-202r2} [28:37++] Insert new subclause ``6.9a Edits to annex A Insert new bullet point at the end of the list, changing the previously-final full stop to a semicolon, "- whether a procedure defined by means other than Fortran is an asynchronous communication initiation or completion procedure.'' {Editor: Other missing processor-dependencies:} [28:37+] add the following to the processor-dependencies list: " - the value of CFI_MAX_RANK in the file CFI_Fortran_binding.h; - the value of CFI_VERSION in the file CFI_Fortran_binding.h; - which error condition is detected if more than one error condition is detected for an invocation of one of the functions specified in the file CFI_Fortran_binding.h; - the values of the type specifier macros defined in the file CFI_Fortran_binding.h; - which additional type specifier values are defined in the file CFI_Fortran_binding.h; - the values of the error code macros, except for CFI_SUCCESS, defined in the file CFI_Fortran_binding.h; - the base address of a zero-sized array;" 6.10 Edits to annex C ---------------------- {11-160r1}{Editor: corrected to reflect A.1.x deletions.} [28:40] Replace "A.1.6" with "A.1.4" and replace "C.11.11" with "C.11.9". {Editor: Adjust subclause numbers in 007 Annex C.} [29:1] Replace "C11.12" with "C11.10". {Editor: Adjust subclause numbers in 007 Annex C.} [29:2] Replace "C11.13 to C11.15" with "C11.11 to C11.13." A.1.1 Using assumed type in the context of interoperability with C ------------------------------------------------------------------ {11-165r1} {Editor: removed hyphen in "assumed-type".} [31:20+] Add a new paragraph: "Because the purpose of assumed-type is to allow the companion processor to bypass some of the strictness of the typing in the Fortran standard, it is not generally a suitable type for use within a Fortran program and no facilities have been provided to make it more useful for that." {Editor: Because 11-166r2 deleted another type(*) example, the text at [31:21] is no longer correct.} [31:21] Replace "A.1.2 - A.1.4" by "A.1.2 and A.1.3". A.1.3 A constructor for an interoperable unlimited polymorphic entity --------------------------------------------------------------------- {Editor: 11-160r1 says to remove the placeholder for A.1.3 at [33:32-33], but the edit to actually do that was omitted. Added here.} [33:32-33] Delete subclause A.1.3. A.1.5 Casting TYPE(*) in Fortran -------------------------------- {11-166r2} [34:16-44] Delete example A.1.5. A.2.2 Changing the attributes of an array ----------------------------------------- {11-168r2} [38:4] Replace "two C descriptors" by "the first C descriptor for an allocatable entity" {11-168r2} {Editor: removed extra comma at end of edit.} [38:5] Replace "copies the base_addr ... second descriptor" by "constructs the second descriptor by invoking CFI_section with the value CFI_attribute_assumed for the attribute parameter," {11-168r2} [38:11] Replace the declaration of dims by "CFI_index_t extents[2];" {11-168r2} [38:21] Replace "dims" by "NULL" {11-168r2} [38:23+] Add following lines: "/* Extract extents from descriptor */ extents[0] = desc_alloc->dim[0].extent; extents[1] = desc_alloc->dim[1].extent;" {11-168r2} [38:25] delete this line {11-168r2} [38:32] Replace "desc_alloc->dim" by "extents"; {11-168r2} {Editor: moved to [38:35+] since this is not C code.} [38:32+] Add text "After invocation of the second CFI_establish, the lower bounds stored in the /dim/ member of /desc_assum/ will have the value 0 even if the corresponding entries in /desc_alloc/ have different values." A.2.3 Example for creating an array slice in C ---------------------------------------------- {11-168r2} [39:5] Replace declaration of dims by "CFI_index_t lower_bound[1], upper_bound[1], stride[1];" {11-168r2} [39:8-19] Replace these lines by "/* Create a new descriptor which will contain the section */ status = CFI_establish( (CFI_cdesc_t *) &array, NULL, CFI_attribute_assumed, int_array->type, int_array->elem_len, /* rank */ 1, /* extents is ignored */ NULL); lower_bound[0] = int_array->dim[0].lower_bound; upper_bound[0] = lower_bound[0] + (int_array->dim[0].extent - 1); stride[0] = 2; status = CFI_section( (CFI_cdesc_t *) &array, (CFI_cdesc_t *) &int_array, lower_bound, upper_bound, stride); {11-168r2} [39:26-31] Both paragraphs can be removed because the new rules force the programmer to use CFI_establish followed by CFI_section in this context, hence the discussion of descriptor corruption is superfluous. (One could add some words why the result cannot be a formal parameter, but it may be a better idea to put that into a NOTE accompanying the function description, or the - presently still missing - rules in 5.2.6). {11-168r2} [40:2] Replace "CFI_dim_t dims[1]" by "CFI_index_t extent[1];" {11-168r2} [40:8-10] Replace definition of dims by "extent[0] = ARRAY_SIZE;" {11-168r2} [40:11] Remove comment (leftover from a much earlier version) {11-168r2} [40:16] Replace "sizeof(int)" by "/* element length is ignored */ 0,". {11-168r2} [40:18] Replace "dims" by "extent" A.2.4 Example for handling objects with the POINTER attribute ------------------------------------------------------------- {11-168r2}{Editor: Added "status=" in front of CFI_establish.} [40:36+] Insert the following statements: "CFI_CDESC_T(0) yp; int status; /* make local yp point at y */ CFI_establish( (CFI_cdesc_t *) &yp, &y, CFI_attribute_pointer, CFI_type_int, /* elem_len is ignored */ sizeof(int), /* rank */ 0, /* extents are ignored */ NULL);" {11-168r2} [40:37-45] Replace condition and invocation of CFI_establish by "/* Pointer association of ip with yp */ status = CFI_setpointer(ip, (CFI_cdesc_t *) &yp, NULL); if (status != CFI_SUCCESS) { /* handle run time error */ }" {11-168r2} [40:46+] Add text: "The restrictions on the use of CFI_establish prohibit direct modification of the incoming pointer entity ip by invoking that function on it."