fpt and WinFPT Reference Manual - Command-line Commands

| SimCon Home | Ref Manual Home |

CHECK EXPRESSIONS

Syntax:

[DO NOT] CHECK EXPRESSIONS [DO NOT] CHECK DATA TYPES

Function:

fpt analyses all expressions in the code for potential anomalies. Diagnostics are reported if:

Where to Use this Command

Operating system command line Yes
Configuration file, config.fsp Yes
Specification (fsp) files, *.fsp Yes
Interactively, to FPT> prompt Yes
Interactive command files Yes
Embedded in the Fortran code No

Default

Some cases, e.g. loss of precision in assignment across an equals sign and integers raised to negative powers are reported by default. Simple cases of mixed precision are not. (Note that defaults may be changed in the configuration file).

Examples

fpt is run interactively. In this code, r4 and r8 are 4 and 8-byte real numbers and i4 is a 4-byte integer. The command is made:

FPT> check expressions Check of Expressions and Data Type Coercion =========================================== Anomalies detected as shown in the following statements ------------------------------------------------------- Line: 9, File: e:\winfpt\fpt\fpttest\t_expressions.f90 R8=R4 !----------^------------------------------------------------------------------- !!! FPT - 3069 The left-hand-side variable will not have the expected precision !------------------------------------------------------------------------------ Line: 10, File: e:\winfpt\fpt\fpttest\t_expressions.f90 I4=R4 !----------^------------------------------------------------------------------- !!! FPT - 2865 REAL value assigned to INTEGER variable - danger of overflow !------------------------------------------------------------------------------ Line: 11, File: e:\winfpt\fpt\fpttest\t_expressions.f90 C R8=R8+R4 !-----------^------------------------------------------------------------------ !!! FPT - 3437 Mixed real or complex sizes in expression - loss of precision !------------------------------------------------------------------------------ Line: 15, File: e:\winfpt\fpt\fpttest\t_expressions.f90 IF (IE) THEN !-----------^------------------------------------------------------------------ !!! FPT - 2533 Incorrect data type for this IF, DOWHILE or DOUNTIL statement !------------------------------------------------------------------------------ Line: 19, File: e:\winfpt\fpt\fpttest\t_expressions.f90 C R8=1.0*10**(-6) !--------------------^--------------------------------------------------------- !!! FPT - 3075 Integer raised to negative power - The result is usually zero !------------------------------------------------------------------------------ Summary ------- Number of data type coercions made: 0 Statements with expression or un-corrected data type anomalies: 5 ******************************************************************************* FPT>

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