Visible to Intel only — GUID: GUID-43F4AF86-A379-460E-B029-B89461183B34
Visible to Intel only — GUID: GUID-43F4AF86-A379-460E-B029-B89461183B34
Branch Statements Overview
Branching affects the normal execution sequence by transferring control to a labeled statement in the same scoping unit. The transfer statement is called the branch statement, while the statement to which the transfer is made is called the branch target statement. A branch target statement inside a construct may only be branched to from within the same block of the construct that contains the branch target statement.
Any executable statement can be a branch target statement, except for the following:
CASE statement
ELSE statement
ELSE IF statement
END FORALL statement
END WHERE statement
RANK case statement
A statement in a FORALL or WHERE construct
A type-guard statement (TYPE IS, CLASS IS, or CLASS DEFAULT)
Certain restrictions apply to the following statements:
Statement |
Restriction |
---|---|
DO terminal statement |
The branch must be taken from within its nonblock DO construct1. |
END ASSOCIATE |
The branch must be taken from within its ASSOCIATE construct. |
END BLOCK |
The branch must be taken from within its BLOCK construct. |
END DO |
The branch must be taken from within its block DO construct. |
END IF |
The branch should be taken from within its IF construct2. |
END SELECT |
The branch must be taken from within its SELECT CASE, SELECT RANK, or SELECT TYPE construct. |
1If the terminal statement is shared by more than one nonblock DO construct, the branch can only be taken from within the innermost DO construct. 2You can branch to an END IF statement from outside the IF construct; this is a deleted feature in the Fortran Standard. Intel® Fortran fully supports features deleted in the Fortran Standard. |
The following are branch statements:
GOTO - Unconditional statement
Transfers control to the same branch target statement every time it executes.
GOTO - COMPUTED statement
Transfers control to one of a set of labeled branch target statements based on the value of an expression.
CALL statement with an alternate return specified
Transfers control to one of the alternate return branch target statements based on the value of the expression on the RETURN statement executed in the called subroutine to return control to the caller.
An input/output statement with an END=, EOR=, or ERR= specifier
Transfers control to the specified labeled branch target statement if an end of file condition (END=), an end of record condition (EOR=), or an error condition (ERR=) occurs during execution of the input/output statement.
ASSIGN and assigned GO TO statements
Assigns a label to an integer variable. Subsequently, this variable can be used as a branch target statement by an assigned GO TO statement or as a format specifier in a formatted input/output statement.
These statements are deleted features in Fortran 95. Intel® Fortran fully supports features deleted in Fortran 95.
IF - Arithmetic statement
Conditionally transfers control to one of three statements, based on the value of an arithmetic expression.