Go to main content
Oracle® Developer Studio 12.6: Fortran User's Guide

Exit Print View

Updated: July 2017

4.6 Fortran 200x Features

A number of new features in the Fortran 2003 and Fortran 2008 standards appear in this release of the Oracle Developer Studio Fortran compiler. For details, refer to the appropriate Fortran standard.

4.6.1 Interoperability with C

The new standard for Fortran provides:

  • a means of referencing C language procedures and, conversely, a means of specifying that a Fortran subprogram can be referenced from a C function, and

  • a means of declaring global variables that are linked with external C variables

The ISO_C_BINDING module provides access to named constants that are kind type parameters representing data that is compatible with C types.

The standard also introduces the BIND(C) attribute. A Fortran derived type is interoperable with C if it has the BIND attribute.

The Fortran compiler implements the features described in Chapter 15 of the Fortran standard. All intrinsic functions defined in Chapter 15 have been implemented. Fortran also provides facilities for defining derived types and enumerations that correspond to C types, as described in Chapter 4 of the standard.

4.6.2 IEEE Floating-Point Exception Handling

New intrinsic modules IEEE_ARITHMETIC, and IEEE_FEATURES provide support for exceptions and IEEE arithmetic in the Fortran language. Full support of these features is provided by:



The INTRINSIC keyword is new in Fortran 2003.These modules define a set of derived types, constants, rounding modes, inquiry functions, elemental functions, kind functions, and elemental and non-elemental subroutines. The details are contained in Chapter 14 of the Fortran 2003 standard.

4.6.3 Command-Line Argument Intrinsics

The Fortran 2003 standard introduces three new intrinsics for processing command-line arguments and environment variables. These are:

  • GET_COMMAND(command, length, status)

    Returns in command the entire command line that invoked the program.

  • GET_COMMAND_ARGUMENT(number, value, length, status)

    Returns a command-line argument in value.

  • GET_ENVIRONMENT_VARIABLE(name, value, length, status, trim_name)

    Return the value of an environment variable.

4.6.4 PROTECTED Attribute

The Fortran compiler now accepts the Fortran 2003 PROTECTED attribute. PROTECTED imposes limitations on the usage of module entities. Objects with the PROTECTED attribute are only definable within the module that declares them.

4.6.5 Fortran 2003 Asynchronous I/O

The compiler recognizes the ASYNCHRONOUS specifier on I/O statements:


This syntax is as proposed in the Fortran 2003 standard, Chapter 9. In combination with the WAIT statement it allows the programmer to specify I/O processes that may be overlapped with computation. While the compiler recognizes ASYNCHRONOUS=’YES’, the standard does not require actual asynchronous I/O. In this release of the compiler, I/O is always synchronous.

4.6.6 Extended ALLOCATABLE Attribute

Fortran 2003 extends the data entities allowed for the ALLOCATABLE attribute. Previously this attribute was limited to locally stored array variables. It is now allowed with:

  • array components of structures

  • dummy arrays

  • array function results

  • polymorphic entities in a CLASS type specifier

Allocatable entities remain forbidden in all places where they may be storage-associated: COMMON blocks and EQUIVALENCE statements. Allocatable array components may appear in SEQUENCE types, but objects of such types are then prohibited from COMMON and EQUIVALENCE.

4.6.7 VALUE Attribute

The f95 compiler accepts the Fortran 2003 VALUE type declaration attribute.

Specifying a subprogram dummy input argument with this attribute indicates that the actual argument is passed “by value”. The following example demonstrates the use of the VALUE attribute with a C main program calling a Fortran subprogram with a literal value as an argument:

C code:
#include <stdlib.h>
int main(int ac, char *av[])

Fortran code:
       subroutine to_fortran(i)
       integer, value :: i
       print *, i

4.6.8 Fortran 2003 Stream I/O

The Fortran 2003 standard defines a new “stream” I/O scheme. Stream I/O access treats a data file as a continuous sequence of bytes, addressable by a positive integer starting from 1. The data file can be connected for either formatted or unformatted access.

Declare a stream I/O file with the ACCESS=’STREAM’ specifier on the OPEN statement. File positioning to a byte address requires a POS=scalar_integer_expression specifier on a READ or WRITE statement. The INQUIRE statement accepts ACCESS=’STREAM’, a specifier STREAM=scalar_character_variable, and POS=scalar_integer_variable.

4.6.9 Fortran 2003 IMPORT Statement

The IMPORT statement specified entities in the host scoping unit that are accessible by host association. It is allowed only in an interface body.

4.6.10 Fortran 2003 FLUSH I/O Statement

The f95 compiler accepts the Fortran 2003 FLUSH statement. The FLUSH statement makes data written to an external file available to other processes, or causes data placed in an external file by means other than Fortran to be available to a READ statement.

4.6.11 Fortran 2003 POINTER INTENT Feature

The Fortran compiler now supports the INTENT attribute for POINTER dummy arguments: INTENT(IN), INTENT(OUT), or INTENT(INOUT) may be specified for pointer dummies.

For example,

subroutine sub(P)
integer, pointer, intent(in) :: p


The INTENT attribute for pointers applies to the pointer and not what it points to, so for INTENT(IN) pointers, the following are illegal because they modify the pointer:

 p => t

But the following is legal for INTENT(IN) pointers, because it modifies the pointee:

 p = 400

4.6.12 Fortran 2003 Enhanced Array Constructor

Use of square brackets in place of (/ and /) in array constructors is allowed:

X = [ 3.2, 4.01, 6.5 ]

The Fortran 2003 standard allows the use of square brackets as array constructors.

The array components within an array constructor can have two forms:

type-spec ::


[type-spec ::] ac-value-list

When the optional type-spec is present, the types and kinds of the array components do not have to be the same as long as they are type compatible to the type-spec.

type-spec can be an intrinsic type or a derived type.

4.6.13 Object-Oriented Fortran Support

Complete support for polymorphism in Fortran 2003 is available.

4.6.14 FINAL Subroutine Support

FINAL subroutines, a Fortran 2003 feature, is supported.

4.6.15 Procedure Pointer Support

Procedure pointers, a Fortran 2003 feature, is supported.

4.6.16 Parameterized Derived Type

The parameterized derived type (PDT), as defined in the Fortran 2015 standard, is now supported. The Fortran 2015 standard does not allow derived type with the SEQUENCE attribute to have type parameters. Therefore, SEQUENCE and BIND(C) will result in errors when used in a parameterized derived type declaration.

Example of a parameterized derived type:

TYPE matrix(k,m,n)
INTEGER, KIND :: k=KIND(0.0D0)  !  default value
INTEGER, LEN :: m,n                            ! no default value
REAL(kind) :: element(m,n)
TYPE (matrix(10,20)) dm
TYPE (matrix(4,10,20)) sm

Each usage of a declared Parameterized Derived Type (PDT) to declare a symbol must specify all kind of parameter values as constant integers, either specifically or by default. Each instance of such usage creates a usage PDT whose name, in this implementation convention contains all the kind parameter values in the order the kind parameters are declared, separated by commas and enclosed by parentheses. For the above example, the symbol dm has the usage PDT matrix(8) and the symbol sm has the type matrix(4). This convention establishes matrix(8) and matrix(4) as two different usage PDTs and the assignment:


will result in the error:

sm = dm
pdt_matrix.f90, Line = 10, Column = 4: ERROR: Assignment of a 
type (MATRIX(8)) expression to a type(MATRIX(4)) variable is not allowed.

4.6.17 Additional Fortran 2003 and Fortran 2008 Features

Refer to the published Fortran 2003 and Fortran 2008 standards for details.

  • 2003 extensions to allocatable arrays — reallocation on assignment, and allocatable scalars.

  • 2003 extensions to ALLOCATE/DEALLOCATE statements — ERRMSG and SOURCE.

  • 2003 extensions MOVE_ALLOC intrinsic.

  • 2003 extensions pointer assignment with remapping.

  • 2003 extensions MIN/MAX, MIN/MAXVAL and MIN/MAXLOC with character arguments.

  • 2003 intrinsics IS_IOSTAT_END, IS_IOSTAT_EOR, NEW_LINE.

  • 2003 intrinsic SELECTED_CHAR_KIND.

  • 2003 REAL type for argument COUNT_RATE of intrinsic SYSTEM_CLOCK.

  • 2003 new restriction on complex SQRT intrinsic result.

  • 2008: Use of null pointers as missing optional arguments.


  • Enhanced structure constructor: using component names to construct a structure constant.

  • Enhanced PUBLIC/PRIVATE access control on module derived types and components.

  • More Fortran 2008 math intrinsic function support. Most Fortran 2008 math intrinsic functions are now supported except for ERFC_SCALED, NORM2 and some REAL*16 variants on x86 platforms.

  • Derived types with no components.


  • The BACK argument was added to MINLOC and MAXLOC intrinsics.

  • New intrinsics FINDLOC and STORAGE_SIZE were added.

  • New keywords ERRMSG, SOURCE and MOLD were added to ALLOCATE statement, and ERRMSG was added to DEALLOCATE statement.

  • Enumeration with ENUM.

  • VOLATILE keyword.

  • PUBLIC/PRIVATE accessibility on individual components.

  • Public entities of private types.

  • Enhanced complex constants.

  • Fortran 2003 ISO_FORTRAN_ENV module.

  • New KIND= optional argument to intrinsics.

  • Names of length up to 127 characters, except for module names, which are limited to 31 characters.

  • ID= and PENDING= specifier in INQUIRE statement.

  • POS= specifier in data transfer and INQUIRE statements.


  • DC, DP, RD, RC, RN, RP, RU, RZ edit descriptors.

  • INTRINSIC and NON_INTRINSIC keywords in USE.

  • IS_IOSTAT_END and IS_IOSTAT_EOR intrinsics.

  • Support for deferred-length character declarations. For example, CHARACTER (LEN=:), POINTER :: STR.

  • Support passing TARGET objects to INTENT(IN) pointer dummies. This is a Fortran 2008 feature.