Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 9/08/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Syntax Rules for Compiler Directives

The following syntax rules apply to all general and OpenMP* Fortran compiler directives. You must follow these rules precisely to compile your program properly and obtain meaningful results.

A directive prefix (tag) takes one of the following forms:

General compiler directives:

!DIR$

OpenMP Fortran compiler directives:

!$OMP

The following prefix forms can be used in place of !DIR$: cDIR$, cDEC$, or !MS$, where c is one of the following: C (or c), !, or *.

The following prefix forms can be used in place of !$OMP: c$OMP, where c is one of the following: C (or c), !, or *.

The following are source form rules for directive prefixes:

  • In fixed and tab source forms, prefixes begin with !, C (or c), or *.

    The prefix must appear in columns 1 through 5; column 6 must be a blank or a tab (except for prefix !MS$). From column 7 on, blanks are insignificant, so the directive can be positioned anywhere on the line after column 6.

  • In free source form, prefixes begin with !.

    The prefix can appear in any column, but it cannot be preceded by any nonblank, nontab characters on the same line.

  • In all source forms, directives spelled with two keywords can be separated by an optional space; for example, "LOOP COUNT" and "LOOPCOUNT" are both valid spellings for the same directive. However, when a directive name is preceded by the prefix "NO", this is not considered to be two keywords. For example, "NO DECLARE" is not a valid spelling; the only valid spelling for this directive is "NODECLARE".

A compiler directive ends in column 72 (or column 132, if compiler option extend-source is specified).

General compiler directives and OpenMP Fortran directives can be continued in the same way as Fortran statements can be continued:

  • In fixed form, the first line of the directive {initial line} has the directive prefix is in columns 1 through 5 and has a blank, a tab, or a zero in column 6; each continued line of the directive has the directive prefix in columns 1 through 5 and has a character other than a blank, a tab, or a zero in column 6.

  • In free form, the initial line of the directive ends with an ampersand followed by an optional comment beginning with an exclamation point. Each continued line of the directive has the directive prefix optionally preceded by blanks or tabs, followed by an ampersand optionally preceded by blanks or tabs.

A comment beginning with an ! can follow a compiler directive on the same line.

Additional Fortran statements (or directives) cannot appear on the same line as the compiler directive.

Compiler directives cannot appear within a continued Fortran statement.

Blank common used in a compiler directive is specified by two slashes (/ /).

If the source line starts with a valid directive prefix but the directive is not recognized, the compiler displays an informational message and ignores the line.