FPT and WinFPT Reference Manual - Command-line Commands

| SimCon Home | Reference Manual Home |


REMOVE INTENT SPECIFICATIONS

Syntax:

[DO NOT] REMOVE INTENT SPECIFICATIONS

Function:

FPT systematically removes all non-mandatory INTENT statements and INTENT specifications within type declarations from the code.

Note that a small number of INTENT specifications are required by the Fortran standard. The arguments of PURE and ELEMENTAL functions and of the functions used to support user-defined and overloaded operators are required to be declared INTENT(IN). The INTENT declarations in these constructs are left in place.

Where to use this command:

Operating system command line

Yes


Configuration file, config.fsp

Yes


Specification (FSP) files, *.fsp

Yes


Interactively, to FPT> prompt:

No


Interactive command files

No


Embedded in the Fortran code

No


Motivation:

Declarations of INTENT are useful because they show the assumptions which the programmer makes in designing the code. Also, there are circumstances in which compilers can check the INTENT of arguments and can report errors if INTENT violations occur. However, the authors have found only one compiler, Salford Software FTN95, which checks the INTENT of arguments which are passed down into lower level routines. There is therefore a significant risk that INTENT declarations may be incorrect.

A study of WRF, a major weather and climate modelling code, was carried out, please see: "Systematic Errors in Climate Models Consequent on the Design of the Fortran Language", Collins J, Anderson M, Farrimond B, Bayliss D and Owens D, 2013, Poster presented at the 4th WGNE Workshop on Systematic Errors in Weather and Climate Models, The Met Office, Exeter, UK, April 2013. The study showed:

Total number of arguments 53,908
Declared INTENT(IN) 28,460
Declared INTENT(OUT) 6,155
Declared INTENT(IN OUT) 5,384
No declared INTENT 13,884
Sub-program formal arguments 25
INTENT(IN) violations 137 0.5%
INTENT(OUT) violations 102 1.7%
Possible INTENT(OUT) violations 1,292 21.0%

Considerable care is taken in the maintenance of WRF, but maintenance of the INTENT construct has proved to be difficult. This could have serious consequences if the Fortran compiler were to take advantage of the INTENT declarations to optimise the code. In fact there is evidence that two compilers, Intel ifort and gnu gfortran, do not use INTENT declarations in this way.

Default:

No changes are made by default (Note that defaults may be changed in the configuration file).

Related Commands

The command CHECK INTENT identifies INTENT violations and generates a summary report.

The command ENFORCE INTENT IN AS DECLARED modifies the code to correct INTENT(IN) violations by copying the arguments affected to local variables.


Copyright ©1995 to 2014 Software Validation Ltd. All rights reserved.