(j3.2006) GOTO label - with label in BLOCK and in inclusive scope
Tobias Burnus
burnus
Thu Aug 18 08:35:20 EDT 2011
Dear all,
I was wondering whether the following program is valid - and, if so, to
which label jumps the goto?
block
goto 1
stop "one"
1 continue
stop "two"
end block
1 continue
stop "three"
end
The programs seems to be valid as the following is fulfilled:
"The same statement label shall not be given to more than one statement
in its scope." (F2008, "3.2.5 Statement labels")
And BLOCK is a scoping unit of its own: "1.3.124 scoping unit. BLOCK
construct, derived-type definition, interface body, program unit, or
subprogram, excluding all nested scoping units in it."
And "8.2 Branching" tells me:
"A branch causes a transfer of control from one statement to a labeled
branch target statement in the same inclusive scope."
Plus for GOTO (R851):
"C846 (R851) The label shall be the statement label of a branch target
statement that appears in the same inclusive scope as the goto-stmt."
with
"1.3.87 inclusive scope. nonblock scoping unit plus every block
scoping unit whose host is that scoping unit or that is nested within
such a block scoping unit
NOTE 1.5
That is, inclusive scope is the scope as if BLOCK constructs were not
scoping units."
Thus, also the GOTO seems to be valid. However, to which label does the
GOTO jump to?
Tobias
More information about the J3
mailing list