Intel® Fortran Compiler 18.0 Developer Guide and Reference

Rules for Placement of Directives

Directives can have different effects depending on placement:

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.