Fortran 2008

Segments of this document contain information based on the Fortran 2008 standard. The standard is open to continual interpretation, modification and revision. IBM reserves the right to modify the behavior of any features of this product to conform with future interpretations of this standard.

The Fortran Standards Committee responds to questions of interpretation about aspects of Fortran. Some questions can relate to language features already implemented in the XL Fortran compiler. Responses provided by the committee relating to these language features can result in changes to future releases of the XL Fortran compiler. These changes may result in incompatibilities with previous releases of the product.

Some of the Fortran 2008 features are as follows:

Module enhancements
  • Submodules provide additional structuring facilities for modules.
  • To declare a module procedure interface body or define a separate module procedure, specify the MODULE prefix specifier for the FUNCTION or SUBROUTINE statement.
Performance enhancements
  • The DO CONCURRENT construct provides a means for programs to specify that individual loop iterations have no interdependencies.
  • The CONTIGUOUS attribute provides a means for programs to specify restrictions on the storage layout of pointer targets and assumed-shape dummy arguments.
Data declaration
  • A named constant array's shape can be implied by its value. For details, see Implied-shape arrays.
  • A FORALL index variable can have its type and kind explicitly declared within the construct.
  • In addition to derived types, the TYPE type specifier is extended to declare entities of intrinsic types.
  • Multiple type-bound procedures can be declared in a single type-bound procedure statement.
Data usage and computation
  • You can allocate more than one allocate_object by using an ALLOCATE statement that contains the SOURCE= or MOLD= specifier.
  • The MOLD= specifier has been added to the ALLOCATE statement. In addition, you can omit the bounds in the ALLOCATE statement if you provide source_expr in the SOURCE= or MOLD= specifier.
  • The real and imaginary parts of a complex entity can be accessed independently by using complex part designators.
  • Variables now can be polymorphic in an intrinsic assignment.
Input and output
  • NEWUNIT= in an OPEN statement automatically selects a unit number that does not interfere with other unit numbers that are selected by the program.
Execution control
  • The BLOCK construct can contain declarations of objects with construct scope.
  • The EXIT statement can transfer control from within more named executable constructs.
  • The STOP statement can now take an integer or character constant expression as stop code. The ERROR STOP statement initiates error termination of a program while the STOP statement initiates normal termination of a program.
Intrinsic procedures
  • The intrinsic functions ACOS, ASIN, ATAN, COSH, SINH, TAN, and TANH can have arguments of type complex.
  • The new intrinsic functions ACOSH, ASINH, and ATANH calculate the inverse hyperbolic cosine, sine, and tangent respectively.
  • The new intrinsic functions DSHIFTL and DSHIFTR calculate combined left and right shifts.
  • The new intrinsic functions ERF, ERFC, and ERFC_SCALED calculate the error function and its complement.
  • The EXECUTE_COMMAND_LINE subroutine can be used to pass a command to the operating system for execution.
  • The new intrinsic function FINDLOC searches an array for a value.
  • The new intrinsic functions GAMMA and LOG_GAMMA calculate the gamma function and its log.
  • The new intrinsic function HYPOT calculates the Euclidean distance.
  • The new intrinsic function IS_CONTIGUOUS(ARRAY) tests contiguity of an array.
  • The new intrinsic functions LEADZ and TRAILZ return the number of leading and trailing zero bits in an integer.
  • The new intrinsic functions MASKL and MASKR return simple left and right justified masks.
  • A BACK= argument is added to the intrinsic functions MAXLOC and MINLOC.
  • The new intrinsic functions POPCNT and POPPAR return the number of 1 bits of an integer and its parity.
  • The new intrinsic functions SHIFTA, SHIFTL, and SHIFTR perform shift operations.
  • A RADIX= argument has been added to the intrinsic procedure SELECTED REAL KIND.
Intrinsic modules
Programs and procedures
  • A dummy argument that has the POINTER and INTENT(IN) attributes can be argument that is associated with a nonpointer actual argument that has the TARGET attribute. For details, see Pointer dummy argument enhancements.
  • Internal procedures and pointers to internal procedures can be used as actual arguments. Besides, internal procedures can be used as procedure pointer targets.
  • If a dummy argument of an elemental procedure does not have the VALUE attribute, the dummy argument must have the INTENT attribute specified.
  • In a reference to an elemental procedure, if any actual argument is an array, every actual argument that corresponds to an INTENT(OUT) or INTENT(INOUT) dummy argument must be an array.
  • A separate module subprograms defines a separate module procedure that is declared by a corresponding module procedure interface body.
  • Elemental procedures are no longer required to be pure in Fortran 2008. You can explicitly declare procedures with the IMPURE prefix specifier.
  • The generic resolution rules are extended to distinguish between allocatable and pointer dummy arguments and between procedure and data dummy arguments. For details, see Unambiguous generic procedure references.
  • A double colon separator (::) can be used in PROCEDURE and MODULE PROCEDURE statements inside interface blocks.
  • The FUNCTION and SUBROUTINE keywords can be omitted from the END statement for a module or internal subprogram.
  • You can specify the BIND attribute without the NAME= specifier for an internal procedure.
  • You can specify the VALUE attribute on an array dummy argument that has either assumed shape or explicit shape.

For the detailed support status of Fortran 2008 features in XL Fortran, see Fortran 2008 Compliance Status for XL Fortran.

Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us