08-201 To: J3 From: Van Snyder Subject: Construct-scope DO variable Date: 2008 May 31 References: 08-007r2 1. Introduction To avoid requiring the wordy circumlocution DO BLOCK INTEGER :: I DO I = 1, 10 ... END DO END BLOCK just to get a construct-scope , do the same for a that we have done for the FORALL and DO CONCURRENT constructs, viz., allow :: before the -- but only in a : DO INTEGER :: I = 1, 10 ... END DO This would reduce the number of "Why not?" surprises that students of Fortran must endure. There are two possibilities: Allow the only in a , and allow it in any . The latter might be more difficult for processors. It cannot be allowed in nonblock DO constructs because the scopes would overlap: Which I should be used in the shared do-term statement? DO 1 INTEGER :: I = 1, 2 DO 1 INTEGER :: I = 3, 4 1 PRINT *, I 2. Edits for only on a [176: 8.1.7.2 R827] ---------------------------------------------------- Editor: Insert "[ :: ]" before "". [176: 8.1.7.2 C816] ---------------------------------------------------- Editor: Replace C816: "C816 (R827) The shall specify integer type. "C816a (R827) A shall not appear in a . "C816b (R827) If does not appear, shall be a variable of integer type." [176: C819+] ----------------------------------------------------------- Editor: Insert a note: "NOTE 8.10a A is not permitted in a because the ranges of nested nonblock DO constructs overlap, and therefore the scopes of construct-scope DO variables would overlap." [177: 8.1.7.4p1+ or 8.1.7.4p2+] ---------------------------------------- Editor: Insert a new paragraph: "If appears, the in a has a scope of the construct (16.4). It is a scalar variable that has the specified type and type parameters; it has no other attributes." [442: 16.4p1] ---------------------------------------------------------- Editor: Insert a sentence at the end of the paragraph: "A variable that appears as the in a in which a appears is a construct entity." 3. Edits for only in a [176: 8.1.7.2 R827] ---------------------------------------------------- Editor: Insert "[ :: ]" before "". [176: 8.1.7.2 C816] ---------------------------------------------------- Editor: Replace C816: "C816 (R827) The shall specify integer type. "C816a (R827) If does not appear, shall be a variable of integer type." [176: R834+] ----------------------------------------------------------- Editor: Insert a constraint: "C819a (R831) A shall not appear in a in a ." [177: C823+ or 8.1.7.3p2+] --------------------------------------------- Editor: Insert a note: "NOTE 8.10a A is not permitted in a because the ranges of nested nonblock DO constructs overlap, and therefore the scopes of construct-scope DO variables would overlap." [177: 8.1.7.4p1+ or 8.1.7.4p2+] ---------------------------------------- Editor: Insert a new paragraph: "If appears, the in a has a scope of the construct (16.4). It is a scalar variable that has the specified type and type parameters; it has no other attributes." [442: 16.4p1] ---------------------------------------------------------- Editor: Insert a sentence at the end of the paragraph: "A variable that appears as the in a in which a appears is a construct entity."