Fortran 2008 Overview

Table of Contents

1 Introduction

This document describes those parts of the Fortran 2008 language which are not in Fortran 2003, and which are supported by the latest release of the NAG Fortran Compiler.

Features marked as ‘[5.3.1]’ are newly available in release 5.3.1, and those marked as ‘[5.3]’ were available in release 5.3.

2 Overview of Fortran 2008

The new features of Fortran 2008 that are supported by the NAG Fortran Compiler can be grouped as follows:

3 The BLOCK construct [5.3]

This construct allows declarations of entities within executable code. For example,

  Do i=1,n
      Real tmp
      tmp = a(i)**3
      If (tmp>b(i)) b(i) = tmp
    End Block
  End Do
Here the variable tmp has its scope limited to the BLOCK construct, so will not affect anything outside it. This is particularly useful when including code by INCLUDE or by macro preprocessing.

All declarations are allowed within a BLOCK construct except for COMMON, EQUIVALENCE, IMPLICIT, INTENT, NAMELIST, OPTIONAL and VALUE; also, statement function definitions are not permitted.

BLOCK constructs may be nested; like other constructs, branches into a BLOCK construct from outside are not permitted. A branch out of a BLOCK construct “completes” execution of the construct.

Entities within a BLOCK construct that do not have the SAVE attribute (including implicitly via initialisation), will cease to exist when execution of the construct is completed. For example, an allocated ALLOCATABLE variable will be automatically deallocated, and a variable with a FINAL procedure will be finalised.

4 Additional mathematical intrinsic functions [5.3.1]

5 Additional intrinsic functions for bit manipulation [mostly 5.3]

6 Other new intrinsic procedures [5.3.1]

7 Changes to existing intrinsic procedures [5.3.1]

8 ISO_FORTRAN_ENV additions [5.3]

The intrinsic module ISO_FORTRAN_ENV contains additional named constants as follows.

9 Miscellaneous and convenience features [mostly 5.3]

10 References

The Fortran 2008 standard, IS 1539-1:2010(E), is available from ISO as well as from many national standards bodies. A number of books describing the new standard are available; the recommended reference book is “Modern Fortran Explained” by Metcalf, Reid & Cohen, Oxford University Press, 2011 (ISBN 978-0-19-960141-7).