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 can only be branched to from within the same block of the construct that contains the branch target statement.

A branch within a CRITICAL construct must not have a branch target that is outside the construct. A branch to the END CRITICAL statement is permitted from within the construct.

Any executable statement can be a branch target statement, except for the following:

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 CRITICAL

The branch must be taken from within its CRITICAL 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.

END TEAM

The branch must be taken from within the CHANGE TEAM 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:

See Also