J3/09-176 To: J3 From: Van Snyder Subject: "transfer of control" is used improperly, 2.3.5 is incomplete Date: 2009 March 27 References: 09-007r1, 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 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 (in the case an alternative return is not 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". The term "transfer of control" is not defined. There is a partial suggestion of its meaning where 8.2.1p1 [188:3-4] specifies that it is the result of a branch. 8.2.1p1 [188:5] further says that procedure references and control structures also cause transfer of control, but the term is used in several places where this is clearly not desired, resulting in contradictions. Subclause 2.3.5 specifies the execution sequence. The term "change the normal execution sequence", with reference to 2.3.5, should be used instead. Assuming the term "transfer of control" means "change the normal execution sequence," it is almost always used incorrectly; it usually ought to be "branch". The first version of this paper, 08-206, was rejected at meeting 185 with the comment "new feature," but it definitely did not describe a new feature; it was a correction of an incomplete and erroneous description. A successor, 09-109, was submitted to meeting 187, but there wasn't time to process it. This paper updates the references from 09-109 to refer to 09-007r1. 2. Edits w.r.t. 09-007r1. [5:1+ 1.3.17+] --------------------------------------------------------- Editor: Insert a subclause: "1.3.17a branch change the normal execution sequence (8.2)" Index this occurrence of "branch". [13:33+ 1.3.93+] ------------------------------------------------------- Editor: Insert a subclause: "1.3.82a Normal execution sequence the order in which executable constructs appear (2.4.5)" [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 <>". {Define the term "normal execution sequence", which will be used in 8.2.1.} [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 across CONTAINS). [33:14-15 2.3.5p2] ----------------------------------------------------- Editor: Replace the first list item by: "o When a procedure is invoked, the specification expressions within the of the invoked procedure, if any, are evaluated in a processor dependent order. Thereafter, the execution sequence proceeds to the first executable construct appearing within the scoping unit of the procedure after the invoked entry point. "o When execution of a subroutine invoked by execution of a CALL statement completes, execution of the CALL statement that invoked the subroutine completes. When execution of a function completes, evaluation of the expression in which it was invoked either continues or completes. When execution of a final subroutine or a user-defined input/output subroutine that was invoked as part of another process completes, that process either continues or completes. "o Branching (8.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." [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: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." [54:17+8 4.4.2.3: NOTE 4.8] -------------------------------------------- Editor: Replace "transfer of control" by "branch (8.2)". Index this occurrence of "branch" (this occurrence of "transfer of control" is not currently indexed). [132:23 6.7.3.2p2] ----------------------------------------------------- Editor: Replace "When ... statement" by "When a RETURN or END statement is executed". {We don't want the executable constructs after the point of execution of the procedure to start executing until after the allocatable variables are deallocated.} [171:20 8.1.2.1p1] ----------------------------------------------------- Editor: Replace "Transfer of control" by "Branching (8.2)" because "transfer of control" prohibits procedures from returning. Alternative returns are branches, so "Branching" covers that case correctly. 8.2.1 explicitly says that there are transfers of control that are not branches. The two other occurrences of "transfers" in this paragraph are correct. [171:22 8.1.2.1p2] ----------------------------------------------------- Editor: Delete 8.1.2.1p2 because it is repetitive of 2.3.5, and contradicting 8.1.2.1p1 is no longer necessary. [176:36-38 8.1.6.4p1] -------------------------------------------------- Editor: Replace the paragraph by "The <> of a block DO construct is the ." The remainder of the paragraph is repetitive of 8.1.2.1p1. At least replace "transfer of control" by "branching (8.2)" and index this occurrence of branch (this occurrence of "transfer of control" is not currently indexed). [176:42 8.1.6.4p2] ----------------------------------------------------- Editor: Replace "transfer of control" by "branching (8.2)" because "transfer of control" prohibits procedures from returning. Index this occurrence of "branch" (this occurrence of "transfer of control" is not currently indexed). [177:7 8.1.6.6.1p1] ---------------------------------------------------- Editor: After "DO statement" insert "other than a DO CONCURRENT statement" or "that is not a DO CONCURRENT statement". [178:20-23 8.1.6.6.3p5]------------------------------------------------- Editor: Replace the first "transfer of control" by "branch (8.2)" the second by "branching" or "a branch", and the third by "branch". Index these occurrences of "branch" (these occurrences of "transfer of control" are not currently indexed). [188:3-4 8.2.1p1] ------------------------------------------------------ Editor: Replace the first two sentences ("Branching ... same scoping unit") to use the definition of execution sequence in 2.4.5: "A <> alters the normal execution sequence (2.4.5). When a branch occurs, the next statement executed is the branch target statement, in the same scoping unit, that is labeled by the label in the branch, instead of the one that would be executed by continuing the normal execution sequence." [188:7 8.2.1p1] -------------------------------------------------------- Editor: Replace "cause transfer of control" by "change the normal execution sequence". [188:16-17 8.2.2p1] ---------------------------------------------------- Editor: Replace the paragraph by: "Execution of a <> causes a branch to the branch target statement identified by the label." {Use the definitions of "branch" and "branch target statement" in 8.2.1.} [188:23 8.2.3p1] ------------------------------------------------------- Editor: Replace "a transfer of control ... is the one" by "a branch occurs to the branch target statement" {Use the definitions of "branch" and "branch target statement" in 8.2.1.} [188:31-32 8.2.4p1] ---------------------------------------------------- Editor: Replace "transfer of control" by "branch". Insert "is the one" before "identified". Replace "is executed next" by a comma. The result is "The branch target statement is the one identified by the first label, the second label, or the third label, depending on...." {Use the definitions of "branch" and "branch target statement" in 8.2.1.} [313:29-30 12.6.2.7p1] ------------------------------------------------- Editor: Replace "transfers control to the" by "branches (8.2) to the branch target". Replace "transfer of control" by "branch". Index these appearances of "branch". {Use the definitions of "branch" and "branch target statement" in 8.2.1.} [606] ------------------------------------------------------------------ Editor: Replace the index items "transfer of control" by "branch", especially the ones on pp 243-244, because they actually use the term "branch". I think the editorial instructions above accomplish this, but it wouldn't hurt to check.