J3/09-242 To: J3 From: Van Snyder Subject: Description of execution sequence is incorrect and incomplete Date: 2009 June 30 References: 09-007r2, 09-224r3, 09-176r1, 09-109, 08-206 1. Introduction 2.3.5 [33:1ff] is poorly structured. It ought to specify the normal execution sequence first, then the exceptions. Rather, it specifies one exception, then the normal sequence, then some more exceptions. 2.3.5 explains how execution proceeds when procedures are invoked but doesn't explain how execution proceeds when execution of a procedure completes. RETURN [12.6.2.7p1 313:27-31] just says it completes execution of a procedure, except in the case an alternative return is taken, which is explained by reference to branching). END is defined in terms of RETURN. FORALL and WHERE constructs are not mentioned in 2.3.5. We can't just add them to the second list item because they do not have "implicit internal branching". DO CONCURRENT is not properly treated in 2.3.5; it isn't really like other DO constructs in that it does not have "implicit internal branching". 2.3.5p3 prohibits internal subprograms from being executed ("the execution sequence excludes all such definitions"). 8.2.1 says "Although ... control constructs can cause transfer of control they are not branches" but 2.3.5p2 says control constructs have internal branching. We should be consistent. 12.5.3 says that a function is executed, but execution of a statement function is not defined in 12.6.4. The images terminate but the program never does. 3. Edits w.r.t. 09-007r2. [13:33+ 1.3.93+] ------------------------------------------------------- The term "Normal execution sequence" needs to be defined. Editor: Insert a subclause: "1.3.93a <> of executable constructs, the order in which they appear within a scoping unit(2.3.5)" [18:35+ 1.3.133+] ------------------------------------------------------ The term "transfer of control" needs to be defined because we use "transfer" and "control" in other contexts (e.g. "control information list" in a "data transfer statement," presumably for "control of transfer"). Editor: Insert a subclause: "1.3.133a <> execution of a statement other than the next one in the normal execution sequence" [33:8-11 2.3.5p2] ------------------------------------------------------ Editor: Delete "When ... point." Its essence will reappear later. [33:11 2.3.5p2] -------------------------------------------------------- Editor: Replace "effect of execution" by "effect of the normal execution sequence". {Define the term "normal execution sequence".} [33:12 2.3.5p2] -------------------------------------------------------- Editor: Insert "within a scoping unit" before "are executed in the order" and delete "in the main program or subprogram" (so that the execution sequence doesn't flow into internal subprograms). [33:14-15 2.3.5p2] ----------------------------------------------------- Editor: Replace the first list item by: "o Branching (8.2, 9.11.2, 9.11.3, 9.11.4, 12.6.2.7) changes the execution sequence by explicitly specifying a new starting place, within the same scoping unit as the branch, for the execution sequence. "o Invocation of a procedure is described in subclauses 12.5.3 and 12.5.4. When a procedure defined by a subprogram is executed, the specification expressions within the of the invoked procedure, if any, are evaluated in a processor dependent order. Thereafter, if the procedure is defined by a subprogram the execution sequence proceeds to the first executable construct appearing within the scoping unit of the procedure after the invoked entry point. Execution of an intrinsic subroutine consists of carrying out the the actions specified for it in subclause 13.7. "o Completion of execution of a procedure defined by a subprogram is described in subclauses 12.5.3, 12.5.4, and 12.6.2.7. Completion of execution of \obs{a statement function or} an intrinsic function consists of completion of evaluation. Completion of execution of an intrinsic subroutine consists of completion of the actions specified for it in subclause 13.7. After a procedure completes execution, the execution sequence continues by continuing execution of the statement that caused the procedure to be invoked. "NOTE 2.6a Continuing execution of the statement that caused a procedure to be invoked might consist of nothing more than completing execution of that statement, or it might consist of further actions such as \obs{branching to an alternate return specifier,} evaluation of operations in an expression, further data transfer, additional assignments, additional finalizations, etc., which in turn might result in invocation of other procedures by that statement." [33:16 2.3.5p2] -------------------------------------------------------- Editor: After "DO constructs" in the second list item, insert "other than DO CONCURRENT constructs" or "that are not DO CONCURRENT constructs". [33:17 2.3.5p2] -------------------------------------------------------- Editor: Replace "internal branching" by "transfer of control" because 8.2.1 says "although ... control constructs can cause transfer of control they are not branches." [33:18+ 2.3.5p2] ------------------------------------------------------- Editor: Insert list items after the second one: "o A DO CONCURRENT construct (8.1.6) causes a to be executed a specified number of times. During each execution of the the sequence of execution proceeds as specified in this subclause, but the order of executions of the is not specified." "o A WHERE construct (7.2.3) causes s to be executed. During execution of a the sequence of execution proceeds as specified in this subclause, but the order of execution of the s is not specified." "o A FORALL construct (7.2.4) causes a to be executed a specified number of times. During each execution of the the sequence of execution proceeds as specified in this subclause, but the order of executions of the is not specified." [33:22-23 2.3.5p3] ----------------------------------------------------- Editor: Delete the paragraph. The first sentence merely restates syntax. The second prohibits internal subprograms from being executed. [34:4- 2.3.5p7+] ------------------------------------------------------- Editor: Insert a paragraph after NOTE 2.9: "NOTE 2.9a When all images have terminated execution, the program completes execution." [161:8,10,12 7.2.3.1p1 R742]-------------------------------------------- Editor: Replace "[]..." by "" thrice. [161:14+ 7.2.4.1p1 R743+]----------------------------------------------- Editor: Insert a new syntax rule: "R743a <> []..." by "". [164:4+ 7.2.4.1p1 R755+]------------------------------------------------ Editor: Insert a new syntax rule: "R755a <> []..."