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

ID 767251
Date 11/07/2023
Public

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

Document Table of Contents

Rules for Placement of Directives

Directives can have different effects depending on placement:

  • Some directives affect the next statement only.

  • Some directives can appear only at the beginning of a scope and affect the rest of that scope.

  • Some directives affect the statements starting at that point in the source and continue until changed by another directive or until the end of the scope containing the directive.

The scope can be a contained procedure or a program unit. A program unit is a main program, an external subroutine or function, a module, or a block data program unit. A directive does not affect modules invoked with the USE statement in the program unit that contains it, but it does affect INCLUDE statements that follow the directive.

Certain directives may appear before program units or between program units in a source file. These directives affect only the next program unit that lexically follows the directive. The effect of the directive ceases at the end of the affected program unit. For example:

!dir$ integer:2
program m
integer k
print *, kind(k), kind(42)    ! this prints 2, 2 which means the directive took effect
call sub()
end 

subroutine sub()
integer kk
print *, kind(kk), kind(-42)  ! this prints 4, 4 because the INTEGER:2 directive has no effect here
end

The following directives have this behavior:

Other rules may apply to these directives. For more information, see the description of each directive.