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

Statement and Attribute: Allows the specific name of an intrinsic procedure to be used as an actual argument.

The INTRINSIC attribute can be specified in a type declaration statement or an INTRINSIC statement, and takes one of the following forms:

Type Declaration Statement:

type,[att-ls,] INTRINSIC [, att-ls] :: in-pro[, in-pro]...

Statement:

INTRINSIC [::] in-pro[, in-pro] ...

type

Is a data type specifier.

att-ls

Is an optional list of attribute specifiers.

in-pro

Is the name of an intrinsic procedure.

Description

In a type declaration statement, only functions can be declared INTRINSIC. However, you can use the INTRINSIC statement to declare subroutines, as well as functions, to be intrinsic.

The name declared INTRINSIC is assumed to be the name of an intrinsic procedure. If a generic intrinsic function name is given the INTRINSIC attribute, the name retains its generic properties.

Some specific intrinsic function names cannot be used as actual arguments. For more information, see table Specific Functions Not Allowed as Actual Arguments in Intrinsic Procedures.

Example

The following example shows a type declaration statement specifying the INTRINSIC attribute:

PROGRAM EXAMPLE
...
REAL(8), INTRINSIC :: DACOS
...
CALL TEST(X, DACOS)     ! Intrinsic function DACOS is an actual argument

The following example shows an INTRINSIC statement:

Main Program

Subprogram

EXTERNAL CTN

SUBROUTINE TRIG(X,F,Y)

INTRINSIC SIN, COS

Y = F(X)

. . .

RETURN

 

END

CALL TRIG(ANGLE,SIN,SINE)

 

. . .

FUNCTION CTN(X)

 

CTN = COS(X)/SIN(X)

CALL TRIG(ANGLE,COS,COSINE)

RETURN

. . .

END

CALL TRIG(ANGLE,CTN,COTANGENT)

 

Note that when TRIG is called with a second argument of SIN or COS, the function reference F(X) references the Standard Fortran library functions SIN and COS; but when TRIG is called with a second argument of CTN, F(X) references the user function CTN.

The following shows another example:

     INTRINSIC SIN, COS
     REAL X, Y, R 
 !   SIN and COS are arguments to Calc2:
     R = Calc2 (SIN, COS)