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

ID 767251
Date 3/22/2024
Public

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

Document Table of Contents

Intrinsic Procedures

Intrinsic procedures are functions and subroutines that are included in the Fortran library. The following are classes of intrinsic procedures:

  • Elemental procedures

    These procedures have scalar dummy arguments that can be called with scalar or array actual arguments. There are many elemental intrinsic functions and one elemental intrinsic subroutine (MVBITS). All elemental intrinsic procedures are pure.

    If the arguments are all scalar, the result is scalar. If an actual argument is array-valued, the intrinsic procedure is applied to each element of the actual argument, resulting in an array that has the same shape as the actual argument.

    If there is more than one array-valued argument, they must all have the same shape.

    Many algorithms involving arrays can now be written conveniently as a series of computations with whole arrays. For example, consider the following:

      a = b + c
      ...               ! a, b, c, and s are all arrays of similar shape
      s = sum(a)

    The above statements can replace entire DO loops.

    Consider the following:

      real, dimension (5,5) :: x,y
      . . .      ! Assign values to x
      y = sin(x) ! Pass the entire array as an argument

    In this example, since the SIN(X) function is an elemental procedure, it operates element-by-element on the array x when you pass it the name of the whole array.

  • Inquiry functions

    These functions have results that depend on the properties of their principal argument, not the value of the argument (the argument value can be undefined).

  • Transformational functions

    These functions have one or more array-valued dummy or actual arguments, an array result, or both. The intrinsic function is not applied elementally to an array-valued actual argument; instead it changes (transforms) the argument array into another array.

  • Nonelemental procedures

    These procedures must be called with only scalar arguments; they return scalar results. All subroutines (except MVBITS) are nonelemental.

  • Atomic subroutines

    These subroutines perform an action on a variable (its atom argument) atomically. When an atomic subroutine is executed, it is as if the subroutine were executed instantaneously without overlapping other atomic actions that might occur asynchronously. For information on the semantics of atomic subroutines, see Overview of Atomic Subroutines.

  • Collective subroutines

    These subroutines perform a cooperative calculation on a team of images and require no synchronization. For information on the semantics of collective subroutines, see Overview of Collective Subroutines.

The intrinsic subroutine MVBITS, and the subroutine MOVE_ALLOC with a noncoarray argument FROM, are pure. All other intrinsic subroutines are impure.

Intrinsic procedures are invoked the same way as other procedures, and follow the same rules of argument association.

The intrinsic procedures have generic (or common) names, and many of the intrinsic functions have specific names. (Some intrinsic functions are both generic and specific.)

In general, generic functions accept arguments of more than one data type; the data type of the result is the same as that of the arguments in the function reference. For elemental functions with more than one argument, all arguments must be of the same type (except for the function MERGE).

When an intrinsic function is passed as an actual argument to a procedure, its specific name must be used, and when called, its arguments must be scalar. Some specific intrinsic functions are not allowed as actual arguments in all circumstances. The following table lists specific functions that cannot be passed as actual arguments or as targets in procedure pointer assignment statements.

Starting with Fortran 2018, specific names of intrinsic functions that also have generic names are obsolescent.

Specific Intrinsic Functions Not Allowed as Actual Arguments

AIMAX0

FLOATJ

JFIX

MAX0

AIMIN0

FLOATK

JIDINT

MAX1

AJMAX0

FP_CLASS

JIFIX

MIN0

AJMIN0

HFIX

JINT

MIN1

AKMAX0

IADDR

JIQINT

NARGS

AKMIN0

IARGC

JMAX0

QCMPLX

AMAX0

ICHAR

JMAX1

QEXT

AMAX1

IDINT

JMIN0

QEXTD

AMIN0

IFIX

JMIN1

QMAX1

AMIN1

IIDINT

JNUM

QMIN1

CHAR

IIFIX

JZEXT

QNUM

CMPLX

IINT

KIDINT

QREAL

DBLE

IIQINT

KIFIX

RAN

DBLEQ

IJINT

KINT

RANF

DCMPLX

IMAX0

KIQINT

REAL

DFLOTI

IMAX1

KMAX0

RNUM

DFLOTJ

IMIN0

KMAX1

SECNDS

DFLOTK

IMIN1

KMIN0

SHIFTL

DMAX1

INT

KMIN1

SHIFTR

DMIN1

INT1

KNUM

SNGL

DNUM

INT2

KZEXT

SNGLQ

DREAL

INT4

LGE

ZEXT

DSHIFTL

INT8

LGT

 

DSHIFTR

INUM

LLE

 

FLOAT

IQINT

LLT

 

FLOATI

IZEXT

LOC

 

Note that none of the intrinsic subroutines can be passed as actual arguments or as targets in procedure pointer assignment statements.

The A to Z Reference contains the descriptions of all intrinsics listed in alphabetical order. Each reference entry indicates whether the procedure is inquiry, elemental, transformational, or nonelemental, and whether it is a function or a subroutine.