Intel® Fortran Compiler 16.0 User and Reference Guide

Statements

Program statements are grouped into two general classes: executable and nonexecutable. An executable statement specifies an action to be performed. A nonexecutable statement describes program attributes, such as the arrangement and characteristics of data, as well as editing and data-conversion information.

Order of Statements in a Program Unit

The following figure shows the required order of statements in a Fortran program unit. In this figure, vertical lines separate statement types that can be interspersed. For example, you can intersperse DATA statements with executable constructs.

Horizontal lines indicate statement types that cannot be interspersed. For example, you cannot intersperse DATA statements with CONTAINS statements.

Required Order of Statements

Required Order of Statements

PUBLIC and PRIVATE statements are only allowed in the scoping units of modules. In Standard Fortran, NAMELIST statements can appear only among specification statements. However, Intel® Fortran allows them to also appear among executable statements.

The following table shows other statements restricted from different types of scoping units.

Statements Restricted in Scoping Units

Scoping Unit

Restricted Statements

Main program

ENTRY, IMPORT, and RETURN statements

Module1

ENTRY, FORMAT, IMPORT, OPTIONAL, and INTENT statements, statement functions, and executable statements

Submodule1

ENTRY, FORMAT, IMPORT, OPTIONAL, and INTENT statements, statement functions, and executable statements

Block data program unit

CONTAINS, ENTRY, IMPORT, and FORMAT statements, interface blocks, statement functions, and executable statements

Internal subprogram

CONTAINS, IMPORT, and ENTRY statements

Interface body

CONTAINS, DATA, ENTRY, IMPORT2, SAVE, and FORMAT statements, statement functions, and executable statements

BLOCK construct

CONTAINS, DATA, ENTRY, and IMPORT statements, statement functions, and these specification statements: COMMON, EQUIVALENCE, IMPLICIT, INTENT (or its equivalent attribute), NAMELIST, OPTIONAL (or its equivalent attribute), and VALUE (or its equivalent attribute)

1 The scoping unit of a module does not include any module subprograms that the module contains.

2 An IMPORT statement can appear only in an interface body that is not a separate module procedure interface body.

See Also