NAG Fortran Compiler Release 5.3.1 Release Note

NAG Fortran Compiler Release 5.3.1 Release Note

NAG Fortran Compiler Release 5.3.1 Release Note

Table of Contents

1 Introduction

Release 5.3.1 of the NAG Fortran Compiler is a minor update to the compiler, containing several new features and a number of minor improvements to the compiler.

Release 5.3.1 uses the same Kusari licence key as Release 5.3, no new key is needed if a 5.3 licence is available.

See KLICENCE.txt for more information about Kusari Licence Management.

1.1 Compatibility with Releases 5.3 and 5.2

Release 5.3.1 of the NAG Fortran Compiler is fully compatible with Releases 5.3 and 5.2, except that on Windows, modules or procedures whose names begin with a dollar sign ($) need to be recompiled.

1.2 Compatibility with Release 5.1

Release 5.3.1 of the NAG Fortran Compiler is compatible with NAGWare f95 Release 5.1 except that:
  • programs or libraries that use the CLASS keyword, or which contain types that will be extended, need to be recompiled;
  • the following 64-bit platforms, when the -abi=64 option (the default) is used, are binary incompatible and all programs and libraries need to be recompiled: NPL6A51NA, NPMI651NA.

1.3 Compatibility with Earlier Releases

Except as noted, the NAG Fortran Compiler release 5.3.1 is compatible with NAGWare f90 Releases 2.1 and 2.2, as well as with all NAGWare f95 Releases from 1.0 to 5.0, except as noted below.

The following incompatibilities were introduced in Release 5.1:

  • The value returned by STAT=, on an ALLOCATE or DEALLOCATE statement, may differ from the pre-5.1 value in some cases. For further information see the F90_STAT module documentation.
  • Programs that used type extension (EXTENDS attribute) in 5.0 need to be recompiled.
  • Formatted output for IEEE infinities and NaNs is different, and now conforms to Fortran 2003.
  • List-directed output of a floating-point zero now uses F format, as required by Fortran 2003, instead of E format.
  • An i/o or format error encounted during NAMELIST input will now skip the erroneous record. This behaviour is the same as all other formatted input operations including list-directed.

1.4 New Features

Release 5.3.1 contains additional support for OpenMP 3.0.

Runtime detection of integer overflow is now available as an option.

2 OpenMP 3.0 Support

The additional features of OpenMP 3.0 that are now supported are:

  • the COLLAPSE specifier is supported;
  • the COPYIN specifier is supported;
  • the COPYPRIVATE specifier is supported;
  • the LASTPRIVATE specifier is supported;
  • the ORDERED specifier is supported;
  • the THREADPRIVATE data-sharing directive is supported for variables;
  • the locking routines from section 3.3 are supported (both simple locks and nestable locks).

The following tables indicate the support for each feature of OpenMP 3.0.

Executable directive Level of support
PARALLEL Fully supported.
DO Fully supported.
SECTIONS Fully supported.
SINGLE Fully supported.
MASTER Fully supported.
WORKSHARE Not supported.
PARALLEL DO Fully supported.
PARALLEL SECTIONS Fully supported.
TASK Not supported.
CRITICAL Fully supported.
BARRIER Fully supported.
TASKWAIT Not supported.
ATOMIC Fully supported.
FLUSH Fully supported.
ORDERED Fully supported.
Data directive/clauses Level of support
THREADPRIVATE Supported for variables.
DEFAULT Fully supported.
SHARED Fully supported.
PRIVATE Fully supported.
FIRSTPRIVATE Fully supported.
LASTPRIVATE Fully supported.
REDUCTION Fully supported.
COPYIN Fully supported.
COPYPRIVATE Supported for variables.

All the procedures in section 3.2 of the OpenMP standard are supported; these are omp_set_num_threads, omp_get_num_threads, omp_get_max_threads, omp_get_thread_num, omp_get_num_procs, omp_in_parallel, omp_set_dynamic, omp_get_dynamic, omp_set_nested, omp_get_nested, omp_set_schedule, omp_get_schedule, omp_get_thread_limit, omp_set_max_active_levels, omp_get_max_active_levels, get_level, omp_get_ancestor_thread_num, omp_get_team_size and omp_get_active_level.

The lock procedures in section 3.3 of the OpenMP standard are supported; these are omp_destroy_lock, omp_destroy_nest_lock, omp_init_lock, omp_init_nest_lock, omp_set_lock, omp_set_nest_lock, omp_try_set_lock, omp_try_set_nest_lock, omp_unset_lock and omp_unset_nest_lock.

The timing routines in section 3.4 of the OpenMP standard are supported; these are omp_get_wtime and omp_get_wtick. All OpenMP environment variables are supported.

When using the IEEE arithmetic support modules, the IEEE modes (rounding, halting and underflow) are propagated into spawned OpenMP threads at the beginning of a PARALLEL construct, and any IEEE flag that is set by an OpenMP thread is passed back to the parent thread at the end of the PARALLEL construct.

3 Fortran 2003 Features

Additional features of Fortran 2003 are now supported:

  • adjustable, assumed-shape and automatic arrays are now permitted to appear in NAMELIST;
  • character variables with non-constant length are now permitted to appear in NAMELIST;
  • the ROUND= input/output specifier is now supported.
This means that all of Fortran 2003 is supported except for
  • parameterised derived types, and
  • user-defined derived-type input/output.

4 Fortran 2008 Features

  • A named constant (PARAMETER) may be declared with an “implied shape”; this causes the shape to be taken from the expression that defines the constant value — this expression must be an array. The syntax is that each dimension has its upper bound specified as an asterisk (‘*’), for example
        Integer,Parameter :: vten(*) = [ (i,i=1,10) ]
        Real,Parameter :: grid(*,*) = Reshape(vten, [ 2,5 ])
    As usual, if a lower bound other than one is desired it can be specified e.g.
        Real,Parameter :: hgrid(100:*,-100:*) = grid
  • Impure elemental procedures can be defined using the IMPURE keyword. An impure elemental procedure has the restrictions that apply to elementality (e.g. all arguments must be scalar) but does not have any of the “pure” restrictions. This means that an impure elemental procedure may have side effects and can contain input/output and STOP statements. For example,
        Impure Elemental Integer Function checked_addition(a,b) Result(c)
          Integer,Intent(In) :: a,b
          If (a>0 .And. b>0) Then
            If (b>Huge(c)-a) Stop 'Positive Integer Overflow'
          Else If (a<0 .And. b<0) Then
            If ((a+Huge(c))+b<0) Stop 'Negative Integer Overflow'
          End If
          c = a + b
        End Function
    When an argument is an array, an impure elemental procedure is applied to each element in array element order (unlike a pure elemental procedure, which has no specified order). An impure elemental procedure cannot be referenced in a context that requires a procedure to be pure, e.g. within a FORALL construct.

    Impure elemental procedures are probably most useful for debugging (because i/o is allowed) and as final procedures.

  • Assignment to a polymorphic allocatable variable is permitted in Fortran 2008. If the variable has different dynamic type or type parameters, or if an array, a different shape, it is first deallocated. If it is unallocated (or is deallocated by step 1), it is then allocated to have the correct type and shape. It is then assigned the value of the expression. Note that the operaton of this feature is similar to the way that ALLOCATE(variable,SOURCE=expr) works.
  • The new elemental intrinsic functions ACOSH, ASINH and ATANH compute the inverse hyperbolic cosine, sine or tangent respectively. There is a single argument X, which may be of type Real or Complex; the result of the function has the same type and kind. When the argument is Complex, the imaginary part is expressed in radians and lies in the range 0≤im≤π for the ACOSH function, and −π/2≤im≤π/2 for the ASINH and ATANH functions.

    For example, ACOSH(1.543081), ASINH(1.175201) and ATANH(0.7615942) are all approximately equal to 1.0.

  • The intrinsic functions ACOS, ASIN, ATAN, COSH, SINH, TAN and TANH now accept arguments of type Complex. Note that the hyperbolic and non-hyperbolic versions of these functions and the new ACOSH, ASINH and ATANH functions are all related by simple algebraic identities, for example the new COSH(X) is identical to the old COS((0,1)*X) and the new SINH(X) is identical to the old (0,-1)*SIN((0,1)*X).
  • The intrinsic function ATAN now has an extra form ATAN(Y,X), with exactly the same semantics as ATAN2(Y,X).
  • The new elemental intrinsic functions DSHIFTL and DSHIFTR perform double-width shifting. They each have three arguments, I, J and SHIFT which must be of type Integer, except that one of I or J may be a BOZ literal constant – it will be converted to the type and kind of the other I or J argument. I and J must have the same kind if they are both of type Integer. The result is of type Integer, with the same kind as I and J. The I and J arguments are effectively concatenated to form a single double-width value, which is shifted left or right by SHIFT positions; for DSHIFTL the result is the top half of the combined shift, and for DSHIFTR the result is the bottom half of the combined shift.

    For example, DSHIFTL(INT(B'11000101',1),B'11001001',2) has the value INT(B'00010111',1) (decimal value 23), whereas DSHIFTR(INT(B'11000101',1),B'11001001',2) has the value INT(B'01110010',1) (decimal value 114).

  • The new intrinsic subroutine EXECUTE_COMMAND_LINE passes a command line to the operating system's command processor for execution. It has five arguments, in order these are:
    CHARACTER(*),INTENT(IN) :: COMMAND — the command to be executed;
    LOGICAL,INTENT(IN),OPTIONAL :: WAIT — whether to wait for command completion (default true);
    INTEGER,INTENT(INOUT),OPTIONAL :: EXITSTAT — the result value of the command;
    CHARACTER(*),INTENT(INOUT),OPTIONAL :: CMDMSG — the error message if CMDSTAT is non-zero.

    CMDSTAT values are zero for success, −1 if command line execution is not supported, −2 if WAIT is present and false but asynchronous execution is not supported, and a positive value to indicate some other error. If CMDSTAT is not present but would have been set non-zero, the program will be terminated. Note that Release 5.3.1 supports command line execution on all systems, and does not support asynchronous execution on any system.

    For example, CALL EXECUTE_COMMAND_LINE('echo Hello') will probably display ‘Hello’ in the console window.

  • The new elemental intrinsic function HYPOT computes the “Euclidean distance function” (square root of the sum of squares) of its arguments X and Y without overflow or underflow for very large or small X or Y (unless the result itself overflows or underflows). The arguments must be of type Real with the same kind, and the result is of type Real with that kind. Note that HYPOT(X,Y) is semantically and numerically equal to ABS(CMPLX(X,Y,KIND(X))).

    For example, HYPOT(3e30,4e30) is approximately equal to 5e30.

  • The new elemental intrinsic function MERGE_BITS(I,J,MASK) merges the bits from Integer values I and J, taking the bit from I when the corresponding bit in MASK is 1, and taking the bit from J when it is zero. All arguments must be BOZ literal constants or of type Integer, and all the Integer arguments must have the same kind; at least one of I and J must be of type Integer, and the result has the same type and kind.

    Note that MERGE_BITS(I,J,MASK) is identical to IOR(IAND(I,MASK),IAND(J,NOT(MASK))).

    For example, MERGE_BITS(INT(B'00110011',1),B'11110000',B'10101010') is equal to INT(B'01110010') (decimal value 114).

  • The new array reduction intrinsic function NORM2(X,DIM) has been added. This operates exactly the same as SUM and PRODUCT, except that instead of reducing using addition or multiplication, it reduces using the L2 norm; this is the square root of the sum of the squares of the elements. Note that unlike most of the other reduction functions, NORM2 does not have a MASK argument. The DIM argument is optional; an actual argument for DIM is not itself permitted to be an optional dummy argument.

    The calculation of the result value is done in such a way as to avoid intermediate overflow and underflow, except when the result itself is outside the maximum range. For example, NORM2([X,Y]) is approximately the same as HYPOT(X,Y).

  • The intrinsic function SELECTED_REAL_KIND now has a third argument RADIX; this specifies the desired radix of the Real kind requested. Note that the function IEEE_SELECTED_REAL_KIND in the intrinsic module IEEE_ARITHMETIC also has this new third argument, and will allow requesting IEEE decimal floating-point kinds if they become available in the future.
  • The new intrinsic function STORAGE_SIZE(A,KIND) returns the size in bits of a scalar object with the same dynamic type and type parameters as A, when it is stored as an array element (i.e. including any padding). The KIND argument is optional; the result is type Integer with kind KIND if it is present, and default kind otherwise.

    If A is allocatable or a pointer, it does not have to be allocated unless it has a deferred type parameter (e.g. CHARACTER(:)) or is CLASS(*). If it is a polymorphic pointer, it must not have an undefined status.

    For example, STORAGE_SIZE(13_1) is equal to 8 (bits).

  • The FUNCTION and SUBROUTINE keywords on the END statement for an internal or module subprogram is now optional (when the subprogram name does not appear). Previously these keywords were only optional for external subprograms.

5 Performance Enhancements

  • The iterations of an OpenMP DO construct with SCHEDULE(static) are now more evenly distributed.
  • The intrinsic functions COS, COSH, SIN and SINH are now faster on double-double precision values.

6 Additional Error Checking

  • The -C=intovf option has been added; this detects integer overflow at runtime. The overhead is significant and therefore this is included in -C=all but not in -C.
  • Undefined pointer arguments to EXTENDS_TYPE_OF and SAME_TYPE_AS are now detected.
  • An out-of-range POS argument to the intrinsic function BTEST is now detected at runtime (with the -C=bits option).
  • ALLOCATE of a dummy argument that is associated with an actual argument that is not modifiable (e.g. it might be INTENT(IN)) is now detected at runtime with the -C=calls option.

7 Other Enhancements

  • Warnings are now produced for unused PARAMETER definitions, unless they occur within an INCLUDE file. These warnings can be suppressed with the -w=uparam option.
  • Warnings about unused/unreferenced variables are now suppressed following a syntax error.
  • The location reported by some semantic errors has been improved; these now report the location as the subprogram header or the type declaration statement.
  • Multiple redundant warnings for intrinsic function references inside a constant implied DO loop have been suppressed.
  • The makefile-compatible output from “nagfor =depend” has been improved; in particular, a dependency is issued for the main source file, and unusual characters such as space or dollar sign in a file name are now properly quoted.
  • The -paths=absolute and -paths=relative options have been added to “nagfor =depend”. This option controls whether dependencies whose paths are not specified fully (e.g. by the INCLUDE statement) will appear as relative paths or absolute paths.
  • The fixed limits on DO and SELECT construct nesting have been removed; previously these were 199 and 30 respectively, now they are only limited by the memory available to the compiler.
  • TAB characters in runtime format specifications and non-CHARACTER input fields are now treated as blanks.
  • Positioning past the last written character in an output record, using an T, TR or X edit descriptor, no longer causes trailing blanks to be added to the record.
  • The NAMELIST statement is now reentrant and can be safely used with the -thread_safe or -openmp options.
  • The -C=dangling option now interoperates better with the use of the -mtrace= option when trying to detect memory leaks.
  • The maximum size of the symbol table has been increased, enabling compilation of very large and complex source files.
  • When the -nan option is being used, the executable file size caused by a large saved local array has been reduced.
  • On Windows, the “Large Address Aware” option is used for producing 32-bit executables, enabling use of additional address space for a 32-bit program on a 64-bit operating system.

8 Summary release notes for Release 5.3

This section of this Release Note summarises the differences between Releases 5.2 and 5.3.

8.1 New Feature Summary

Release 5.3 supports OpenMP 3.0 (only when the -openmp option is used) and includes many new features from the Fortran 2003 and Fortran 2008 standards.

Additional Fortran 2003 features are supported.

Some Fortran 2008 features are supported.

This release also contains performance enhancements and other minor enhancements. Additionally, several programming tools have been integrated into the compiler system.

8.2 Fortran 2003 Features

  • FINAL subroutines have been added, to provide user-specified finalisation.
  • Structure constructors can now use keywords for component selection, and can omit values for components that have default initialisation. Using keywords it is possible to provide a single value for the whole parent component (or another ancestor component) instead of each inherited component individually.
  • Structure constructors can be overloaded with generic functions.
  • The intrinsic function EXTENDS_TYPE_OF.
  • The intrinsic function SAME_TYPE_AS.
  • Any kind of LOGICAL variable is now accepted in the INQUIRE statement for the EXIST=, NAMED=, OPENED= and PENDING= specifiers.
  • The intrinsic type parameter enquiries %KIND and %LEN have been added; these can be applied to variable designators. The form variable%KIND is the same as KIND(variable), and variable%LEN is the same as LEN(variable), except that the enquiry forms can be used even if the intrinsic function names are not available. Also, the %LEN form returns the length in a kind that is big enough to hold the length, this is not necessarily the same as default integer.
  • All intrinsic functions are now allowed in constant expressions.
  • The full ISO 10646 4-byte character set is supported; the kind is returned by the intrinsic function reference SELECTED_CHAR_KIND('ISO_10646'). As ISO 10646 defines a 2-byte subset (UCS-2) as well as the full 4-byte characters (UCS-4), the intrinsic function SELECTED_CHAR_KIND also recognised the name 'UCS_4' for this character set.
  • The ISO 10646 file encoding UTF-8 is supported; to use this, open the file with ENCODING='UTF-8'. Any kind of character can be written to and read from a UTF-8 file.
  • The intrinsic module ISO_FORTRAN_ENV contains the additional scalar integer constant IOSTAT_INQUIRE_INTERNAL_UNIT. A later release of the NAG Fortran Compiler will support defined input/output; at that time, the value of IOSTAT_INQUIRE_INTERNAL_UNIT identifies the IOSTAT= error value that will result from using INQUIRE in a child input/output statement for an internal file.

8.3 Fortran 2008 Features

  • The BLOCK construct has been added; 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.

  • In a structure constructor, the value for an allocatable component may be omitted: this has the same effect as specifying NULL().
  • In a STOP statement, the stop-code may be any scalar constant expression of type integer or default character. (This also applies to the PAUSE statement, but that statement is no longer standard Fortran.)
  • When the -f2008 option is in effect, ENTRY statements will be reported as obsolescent.
  • The intrinsic module ISO_FORTRAN_ENV contains the additional scalar integer constants INT8, INT16, INT32, INT64, REAL32, REAL64 and REAL128; these supply the kind type parameter values for integer and real kinds with the indicated bit sizes.
  • The intrinsic module ISO_FORTRAN_ENV contains four additional named array constants: CHARACTER_KINDS, INTEGER_KINDS, LOGICAL_KINDS and REAL_KINDS; these list the available kind type parameter values for each type (in no particular order).
  • An empty internal subprogram part, module subprogram part or type-bound procedure part is now permitted following a CONTAINS statement. In the case of the type-bound procedure part, an ineffectual PRIVATE statement may appear following the unnecessary CONTAINS statement.
  • A type-bound procedure declaration statement may now declare multiple type-bound procedures. For example, instead of
          PROCEDURE,NOPASS :: a
          PROCEDURE,NOPASS :: b=>x
          PROCEDURE,NOPASS :: c
    the single statement
          PROCEDURE,NOPASS :: a, b=>x, c
    will suffice.
  • The NEWUNIT= specifier has been added to the OPEN statement; this allocates a new unit number that cannot clash with any other logical unit (the value will be a special negative value). For example,
          INTEGER unit
          WRITE(unit,*) 'Logfile opened.'
    The NEWUNIT= specifier can only be used if either the FILE= specifier is also used, or if the STATUS= specifier is used with the value 'SCRATCH'.
  • The elemental intrinsic functions BGE, BGT, BLE and BLT have been added; these do bitwise (i.e. unsigned) comparisons. They have two arguments, I and J, which must be of type Integer but may be of different kind. The result is default Logical.

    For example, BGE(INT(Z'FF',INT8),128) is true, while INT(Z'FF',INT8)>=128 is false.

  • The array reduction intrinsic functions IALL, IANY and IPARITY have been added. These are exactly the same as SUM and PRODUCT, except that instead of reducing the array by the + or * operation, they reduce it by the IAND, IOR and IEOR intrinsic functions respectively. That is, each element of the result is the bitwise-and, bitwise-or, or bitwise-exclusive-or of the reduced elements. If the number of reduced elements is zero, the result is zero for IANY and IPARITY, and NOT(zero) for IALL.
  • The elemental intrinsic functions LEADZ and TRAILZ have been added; these return the number of leading (most significant) and trailing (least significant) zero bits in the argument I, which must be of type Integer (of any kind). The result is default Integer.
  • The elemental intrinsic functions MASKL and MASKR have been added; these generate simple left-justified and right-justified bitmasks. The value of MASKL(I,KIND) is an integer with the specified kind that has its leftmost I bits set to one and the rest set to zero; I must be non-negative and less than or equal to the bitsize of the result. If KIND is omitted, the result is default integer. The value of MASKR is similar, but has its rightmost I bits set to one instead.
  • The array reduction intrinsic function PARITY has been added. It is exactly the same as ALL and ANY, except that instead of reducing the array by the .AND. or .OR. operation, it reduces it by the .NEQV. operation. That is, each element of the result is .TRUE. if an odd number of reduced elements is .TRUE..
  • The elemental intrinsic functions POPCNT and POPPAR have been added. POPCNT(I) returns the number of bits in the Integer argument I that are set to 1. POPPAR(I) returns zero if the number of bits in I that are set to 1 are even, and one if it is odd. The result is default Integer.
  • The Fortran 2008 rules are used for generic resolution and for checking that procedures in a generic are unambiguous. Under these rules,
    • a dummy procedure is distinguishable from a dummy variable;
    • an ALLOCATABLE dummy variable is distinguishable from a POINTER dummy variable that does not have INTENT(IN).

8.4 Performance Enhancements

  • The intrinsic functions ACHAR and CHAR are now faster in some cases, in particular when applied to arrays or when used in the middle of an expression.
  • The intrinsic functions ADJUSTL, ADJUSTR, LEN_TRIM and TRIM are now faster in many cases.
  • The intrinsic functions MAXLOC and MINLOC are faster on character strings.
  • The intrinsic function MERGE is now faster in some cases, in particular when the non-chosen source expression would have been expensive to compute.
  • The intrinsic function SPREAD is now faster on contiguous arrays.
  • The intrinsic function TRANSPOSE is now faster on large arrays, in particular ones that do not fit in cache.
  • Some variable-sized array constructors are evaluated more quickly, in particular ones which have many elements and an implied-DO structure that is complicated.
  • The performance of the memory allocator when the -thread_safe option is used has been improved.
  • Performance of character assignment has been improved in many cases.

8.5 Additional Error Checking

  • Many-one array assignment, where the left-hand side of an intrinsic assignment statement is a vector-subscripted array section and the vector subscript has duplicate values, is now detected as an error at compilation time when the vector is constant. When the vector is not constant, this error will be detected at runtime if the -C=array option is used.
  • More errors in pointer usage are detected at compile time.
  • IEEE_SET_ROUNDING_MODE now detects a bad ROUND_VALUE argument. IEEE_VALUE now detects a bad CLASS argument.
  • Shape mismatch is more reliably detected in elemental subroutine calls.
  • More shape mismatch errors in intrinsic functions are detected at compile time.

8.6 Other Enhancements

  • The intrinsic module ISO_C_BINDING is available with the -C=undefined option. Note that this option changes the ABI in a way that is incompatible with C; however, it is usable in an all-Fortran program.
  • The standard intrinsic modules for supporting IEC 60559 arithmetic (commonly known as IEEE arithmetic), IEEE_ARITHMETIC, IEEE_EXCEPTIONS and IEEE_FEATURES, are now available with the -C=undefined option.
  • The NAG intrinsic modules F90_GC and F90_PRECONN_IO are now available with the -C=undefined option.
  • The NAG intrinsic modules for Posix support, F90_UNIX_DIR, F90_UNIX_DIRENT, F90_UNIX_ENV, F90_UNIX_ERRNO, F90_UNIX_FILE, F90_UNIX_IO, F90_UNIX_PROC and F90_UNIX, are now available with the -C=undefined option.
  • Improved details in error messages for misusing INTENT(IN) pointers.
  • DO loops that cannot loop because of a STOP or EXIT statement are detected and a warning produced.
  • Line number information has been added to some additional runtime errors when the -g option is used.
  • The -abi=64 and -abi=32 options can now be used on Windows x64 to generate 64-bit and 32-bit programs.
  • The -C=recursion option can now be used at the same time as the -thread_safe option.
  • The -no_underflow_warning option has been added. This link-time option suppresses the warning message that normally appears if a floating-point underflow occurred during execution.
  • The CONVERT= specifier has been added to the OPEN statement. Acceptable values are 'BIG_ENDIAN', 'BIG_IEEE', 'BIG_IEEE_DD', 'BIG_NATIVE', 'LITTLE_ENDIAN', 'LITTLE_IEEE', 'LITTLE_IEEE_DD', 'LITTLE_NATIVE', and 'NATIVE'. This is only allowed for unformatted files, and enables runtime conversion of endianness and file format. Conversion can also be enabled by the environment variable FORT_CONVERTn, where n is the unit number of the file to be converted; this takes precedence over any CONVERT= specifier on the OPEN statement. The -convert= option can also be used to set the default conversion mode for all units that are connected with no CONVERT= specifier or environment variable.
  • Underflow control via IEEE_SET_UNDERFLOW_MODE (and IEEE_GET_UNDERFLOW_MODE) is now available on Windows x64, x86-64 Linux and Apple Intel Mac.
  • Warning messages are now produced for variables that are set but which are definitely never referenced. These warnings can be disabled with the -w=unreffed option.
  • Text files written in CRLF format (DOS/Windows) can now be read as formatted files by a Fortran program running on Unix or Linux.
  • The JIS X 0213:2004 Japanese character set is supported; the kind is returned by the intrinsic function reference SELECTED_CHAR_KIND('JIS_0213'). As this character set is also sometimes referred to as ‘Shift-JIS’, the name 'SHIFT_JIS' is also recognised by the intrinsic function SELECTED_CHAR_KIND.
  • The 2-byte Unicode character set (UCS-2) is supported; the kind is returned by the intrinsic function reference SELECTED_CHAR_KIND('UCS_2').
  • The Shift-JIS file encoding is supported; to use this, open the file with ENCODING='SHIFT_JIS'. Any kind of character can be written to and read from a Shift-JIS file. When writing an ISO-8859-1, UCS-2 or UCS-4 character, if it cannot be represented in Shift-JIS it will be changed to a question mark ('?'). Similarly, when reading into an ISO-8859-1, UCS-2 or UCS-4 variable, if the character read cannot be represented in the variable's character set it will be changed to question mark ('?') if the variable is ISO-8859-1 and to the Unicode replacement character CHAR(INT(Z'fffd'),KIND(variable)) if the variable is UCS-2 or UCS-4.
  • The F90_KIND module now contains the named constants JIS, UCS2 and UCS4 as kind selectors for the Japanese, Unicode UCS-2 and ISO 10646 UCS-4 character sets.
  • Write-only files are now supported. When a write-only file is OPENed with POSITION='ASIS' (or no POSITION= specifier), the file is positioned at the end; this differs from other files which are positioned at the beginning. If the file can be positioned, the REWIND statement will set the position to the beginning; however, the BACKSPACE statement is not operational.
  • The INQUIRE statement now reports more accurate information, in particular for the SIZE=, READ=, READWRITE= and WRITE= specifiers, for both connected and unconnected files.
  • Integer literal constants that are 1 bigger than the maximum value for the particular integer kind, but which are preceded by a unary negation, are accepted. This allows, for example, the expression -128_1 which strictly speaking should be written -127_1-1_1; the former is clearer and more convenient.
  • Allow BIND(C) procedures to be ELEMENTAL. References to such procedures will be done in array element order.

8.7 Integrated Programming Tools

Three software tools that operate on Fortran source files have been integrated into the NAG compiler system.
  • Call Graph Generator — produces a call graph, with optional index and called-by tables.
  • Dependency Analyser — produces information about dependencies on modules or INCLUDE files, in ‘make’ format, as English prose, or as an ordered build list.
  • Polish — polishes (“pretty-prints”) Fortran source files, optionally renumbering statement labels and converting DO statements to the block DO form.

8.8 Miscellaneous

  • On Linux, Mac and Unix systems, the -g option no longer generates upsf95 debugging information as this debugger has been withdrawn. On these platforms the -g option is now simply passed to the C compiler.
  • A new option, -max_parameter_size=N, now controls the maximum size (in MB) allowed for a named constant (PARAMETER) at compile time. The size of named constants is limited to avoid machine slowdowns if a stupendously enormous constant is created accidentally. The default maximum size is 50 MB.
  • The old -f77 option has been renamed -compatible, to better reflect its actual effect (ABI compatibility with another Fortran compiler) and to avoid confusion with -f95, -f2003 and -f2008 (these all set the Fortran standard level).

9 New Fortran Standard

The extensions (described above) which follow the rules of the Fortran 2003 and Fortran 2008 standards are listed below together with the appropriate section number for the reference book ``Modern Fortran Explained'' by Metcalf, Reid & Cohen, Oxford University Press, 2011 printing (ISBN 978-0-19-960142-4).

Section Feature
13.3 Type parameter enquiries (%KIND and %LEN).
14.8 Final subroutines.
15.3 Structure constructor keywords and overloading.
15.10 Intrinsic functions in constant expressions.
17.11 The ROUND= specifier.
17.13 INQUIRE statement LOGICAL variable kinds.
17.17 Enhanced NAMELIST statement.
20.1.1 Implied-shape arrays.
20.1.3 Improved type-bound procedure declaration statement.
20.1.4 Omitting an allocatable value in a structure constructor.
20.1.6 STOP statement changes.
20.5.4 Impure elemental procedures.
20.5.7 Generic resolution changes.
20.6.2 Polymorphic allocatable assignment.
20.7.2 The NEWUNIT= specifier.
20.9.1 Changes to trigonometric intrinsic functions.
20.9.2 New intrinsic functions ACOSH, ASINH and ATANH.
20.9.4 New intrinsic functions HYPOT and NORM2.
20.10.1 New intrinsic functions BGE, BGT, BLE and BLT.
20.10.2 New intrinsic functions DSHIFTL and DSHIFTR.
20.10.3 New intrinsic functions IALL, IANY and IPARITY.
20.10.4 New intrinsic functions LEADZ, POPCNT, POPPAR and TRAILZ.
20.10.5 New intrinsic functions MASKL and MASKR.
20.10.6 New intrinsic function MERGE_BITS.
20.10.7 New intrinsic functions SHIFTA, SHIFTL and SHIFTR.
20.11.2 New intrinsic subroutine EXECUTE_COMMAND_LINE.
20.11.5 New intrinsic function PARITY.
20.11.6 RADIX argument for intrinsic function SELECTED_REAL_KIND.
20.11.7 New intrinsic function STORAGE_SIZE.
20.12.2 Names in ISO_FORTRAN_ENV for common kinds.
20.12.3 Arrays of kinds in ISO_FORTRAN_ENV.
B.10.2 Redundant CONTAINS statement.
B.10.5 Optional keywords on module/internal subprogram END statements.
B.10.6 Referencing the ATAN2 functionality via the name ATAN.
C.2 Obsolescent ENTRY statement.