J3/99-203r1 Date: 9th August 1999 To: J3 From: Malcolm Cohen Subject: Unresolved issues 178-201 (initial and final) 1. Introduction This paper returns the initial/final status essentially to that of 99-007, i.e. it removes the facility entirely. A later paper will add the more manageable subset that is still required by WG5. 2. Overview of edits Delete the syntax (R442). Delete section 4.5.1.5.1 (Initial procedures). Delete section 4.5.1.5.2 (Final procedures). Delete section 4.5.6.1 (Intrinsic structure constructors), re-inserting original text. Delete section 4.5.6.2 (Defined structure constructors). Delete section 6.3 (Initialization and Finalization). Delete back-references throughout the document to 6.3, reinstating the previous text they replaced (in particular, in 6.4.1.2, 6.4.3.1, 6.4.3.2). Return 14.7.5 (Events that cause variables to become defined) and 14.7.6 (Events that cause variables to become undefined) to their previous state. 3. Edits The edits are based on reversing the effect of paper 99-108r1, with page and line number references updated from 99-007 to 99-007r2. [44:12] Change "" to "". [44:20] Delete. [44:28-30] Delete. [46:36] Change "has <> (6.3)" to "is initially defined (14.7.3) or becomes defined as specified in (14.7.5)" [46:37] After "definition." insert "The evaluation rules are those that would be in effect for intrinsic assignment (7.5.1.4) if were a variable assigned the value of . If is of a type for which default initialization is specified for a component, the default initialization specified by overrides the default initialization specified for that component. When one initialization <> another it is as if only the overriding initialization were specified (see Note 4.24). Explicit initialization in a type declaration statement (5.1) overrides default initialization (see Note 4.23)." [49:13-15] Delete. [49:36-52:3] Delete sections 4.5.1.5.1 and 4.5.1.5.2. This deletes issue 192. [59:9-11] Delete "A structure constructor is ... one initial procedure." {The first sentence is not returned to its 99-007 form because that was incorrect - it had not been updated to handle the possible omission of values (for components that have default initialization).} [60:1-61:3] Delete. This deletes the section heading 4.5.6.1 (though almost all of the text remains), syntax rule R451 and issue 193. [61:4] Change "intrinsic-structure-constructor" to "structure-constructor". [63:7-24] Delete section 4.5.6.2. This deletes issue 194. [77:10] Change "undergoes the initialization process (6.3)" to "becomes undefined except for components of an object of derived type for which default initialization has been specified". [78:17-18] Replace last sentence of paragraph with "Because an INTENT(OUT) variable is considered undefined on entry to the procedure, any default initialization specified for its type will be applied." [81:18-36] Replace first two paragraphs of section with text from 99-007, viz "An object with the SAVE attribute, declared in the scoping unit of a subprogram, retains its association status, allocation status, definition status, and value after execution of a RETURN or END statement unless the object is a pointer and its target becomes undefined (14.6.2.1.3(3)). The object is shared by all instances (12.5.2.3) of the subprogram. Such an object is called a saved object. An object with the SAVE attribute, declared in the scoping unit of a module, retains its association status, allocation status, definition status, and value after a RETURN or END statement is executed in a procedure that accesses the module unless the object is a pointer and its target becomes undefined." [86:14-23] Replace "its common ... also contains that common block" with the text from 99-007 (but with the cross-reference fixed), viz "the values in the common block storage sequence (5.5.2.1) at the time a RETURN or END statement is executed are made available to the next scoping unit in the execution sequence of the program that specifies the common block name or accesses the common block". [97:11-14] Delete note.] [109:1-120:19] Delete section 6.3 and renumber remaining sections. This deletes issues 178,179,180,181,182,183,184,185,186,187, 188,189 and 190. [122:28-45] Replace with text from 99-007 [107:28-43], modified to cope with allocatable scalars (not just arrays): "An allocatable object with the SAVE attribute has an initial status of not currently allocated. If the object is allocated, its status changes to currently allocated. The status remains currently allocated until the object is deallocated. An allocatable object that is a dummy argument of a procedure receives the allocation status of the actual argument with which it is associated on entry to the procedure. An allocatable object that is a subobject of a dummy argument of a procedure receives the allocation status of the corresponding component of the actual argument on entry to the procedure. An allocatable object that does not have the SAVE attribute, that is a local variable of a procedure or a subobject thereof, that is not a dummy argument or a subobject thereof, and that is not accessed by use or host association, has a status of not currently allocated at the beginning of each invocation of the procedure. The status may change during execution of the procedure. If the object is not the result variable of the procedure or a subobject thereof and has a status of currently allocated when the procedure is exited by execution of a RETURN or END statement, it is deallocated. Unresolved issue 7 This information is repeated in 6.4.3.1, but the 2 versions don't quite agree, as 6.4.3.1 also adds an exclusion for dummy args. I wonder whether we really need to say the same thing 2 different times anyway. An allocatable object that does not have the SAVE attribute and that is accessed by use association has an initial status of not currently allocated. The status may change during execution of the program. If the object has an allocation status of currently allocated when execution of a RETURN or END statement results in no scoping unit having access to the module, it is processor dependent whether the allocation status remains currently allocated or the array is deallocated." [123:2-5] Delete "The effect of ... (6.3.3).". [125:17+] Reinstate text from [99-007:110:1-20], modified to cope with allocatable scalars, not just allocatable arrays; and to handle INTENT(OUT) correctly. "When the execution of a procedure is terminated by execution of a RETURN or END statement, an allocatable variable that is a local variable of the procedure retains its allocation and definition status if (1) It has the SAVE attribute, (2) It is a dummy argument or a subobject thereof, (3) It is a function result variable or a subobject thereof, (4) It is accessed by use association, if the module defining the array is also accessed by another scoping unit that is currently in execution, or (5) It is accessed by host association. When the execution of a procedure is terminated by execution of a RETURN or END statement, an allocated allocatable variable that is a local variable of the procedure and is not included in the above categories has allocation status as follows: (1) If it is accessed by use association, its allocation status is processor dependent. (2) Otherwise, it is deallocated (as if by a DEALLOCATE statement). If a statement references a function whose result is allocatable or a structure with a subobject that is allocatable, and the function reference is executed, an allocatable result and any subobjects that are allocated allocatable entities in the result returned by the function are deallocated after execution of the statement. When a procedure is invoked, a currently allocated allocatable object that is an actual argument or a subobject of an actual argument associated with an INTENT(OUT) allocatable dummy argument is deallocated. When a variable of derived type is deallocated, any ultimate component that is allocatable and currently allocated is deallocated (as if by a DEALLOCATE statement).". [125:20-22] Delete "Processor merging ... is terminated." [125:23-30] Delete issue 198. [126:5+] Reinstate text from [99-007:110:44-111:11], viz "When the execution of a procedure is terminated by execution of a RETURN or END statement, the pointer association status of a pointer declared or accessed in the subprogram that defines the procedure becomes undefined unless it is one of the following: (1) A pointer with the SAVE attribute, (2) A pointer in blank common, (3) A pointer in a named common block that appears in at least one other scoping unit that is currently in execution, (4) A pointer declared in the scoping unit of a module if the module also is accessed by another scoping unit that is currently in execution, (5) A pointer accessed by host association, or (6) A pointer that is the return value of a function declared to have the POINTER attribute. When a pointer target becomes undefined by execution of a RETURN or END statement, the pointer association status (14.6.2.1) becomes undefined.". [263:23-24] Delete. [277:41-42] Replace "has ... applied to it" with "is considered undefined on entry to the procedure, any default initialization specified for its type will be applied." [279:23-24] Replace "No initialization ... INTENT(OUT)" with the text from 99-007, viz: "If it is of a type for which default initialization is specified for some component, the initialization has no effect". [293:25-38] Delete note 12.43 and issue 200. [372:33] Split into 2 items as per 99-007, i.e. replace with "(4) The pointer is an ultimate component of an object of a type for which default initialization is specified for the component and (a) a function with this object as its result is invoked, (b) a procedure with this object as an INTENT (OUT) dummy argument is invoked, (c) a procedure with this object as an automatic data object is invoked, (d) a procedure with this object as a local object that is not accessed by use or host association is invoked, or (e) this object is allocated, or (5) A procedure with the pointer as an INTENT (OUT) dummy argument is invoked.". [372:37] Split back into 3 items, viz "(2) The target of the pointer is deallocated other than through the pointer, (3) Execution of a RETURN or END statement that causes the pointer's target to become undefined (item (3) of 14.7.6), or (4) Execution of a RETURN or END statement in a subprogram where the pointer was either declared or, with the exceptions described in 6.4.3.2, accessed." [376:5] Split back into 3 items, viz "(1) Variables specified to have initial values by DATA statements, (2) Variables specified to have initial values by type declaration statements, (3) Nonpointer direct components of variables of a type in which default initialization is specified for those components, provided that the variables are not accessed by use or host association, do not have the ALLOCATABLE attribute or POINTER attribute, and either have the SAVE attribute or are declared in a main program, MODULE, or BLOCK DATA scoping unit, and". [377:17] Replace "The ... defined" with "Allocation of an object of a derived type, in which default initialization is specified for any nonpointer direct component, causes that component to become defined". [377:21+] Reinstate text from 99-007, renumbering the list. Viz, "(19) Invocation of a procedure that contains a nonsaved local object that is not a dummy argument, is not accessed by use or host association, has neither the ALLOCATABLE nor POINTER attribute, and is of a derived type in which default initialization is specified for any direct components, causes those components of the object to become defined. (20) Invocation of a procedure that has an INTENT (OUT) nonpointer nonallocatable dummy argument of a derived type that specifies default initialization for a nonpointer direct component, causes that component of the dummy argument to become defined. (21) Invocation of a nonpointer nonallocatable function of a derived type, in which default initialization is specified for a nonpointer direct component, causes that component of the function result to become defined.". [377:39+] Reinstate text from 99-007 and renumber. Viz, "(3) The execution of a RETURN statement or an END statement within a subprogram causes all variables local to its scoping unit or local to the current instance of its scoping unit for a recursive invocation to become undefined except for the following: (a) Variables with the SAVE attribute. (b) Variables in blank common. (c) Variables in a named common block that appears in the subprogram and appears in at least one other scoping unit that is making either a direct or indirect reference to the subprogram. (d) Variables accessed from the host scoping unit. (e) Variables accessed from a module that also is referenced directly or indirectly by at least one other scoping unit that is making either a direct or indirect reference to the subprogram. (f) Variables in a named common block that are initially defined (14.7.3) and that have not been subsequently defined or redefined.". [378:16-17] Change "causes .. defined it" to "for which default initialization has not been specified causes the object to become undefined" [378:24-25] Change "unless ... (6.3)" to "except for any nonpointer direct components of the argument for which default initialization is specified" [378:25+] Reinstate text from 99-007 and renumber list. Viz, "(c) An actual argument associated with a dummy argument with INTENT (OUT) becomes undefined;". [378:29-30] Change "unless ... (6.3)" to "except for those nonpointer direct components of the result variable for which default initialization is specified".