fpt and WinFPT Reference Manual - Command-line Commands

| SimCon Home | Ref Manual Home |

CORRECT USE OF INTEGER FOR LOGICAL

Syntax:

[DO NOT] CORRECT USE [OF] INTEGER FOR LOGICAL

Function:

fpt searches the code for instances of integer variables which are used to control logical IF statements. This is often encountered when code is migrated from VMS. The integers are replaced by logical expressions. The way in which the statements are modified depends on the commands:

REPRESENT TRUE BY LEAST SIGNIFICANT BIT

or

REPRESENT TRUE BY SIGN BIT

as shown in the examples below.

Please note that, by default, fpt will issue a diagnostic if an integer variable is used in a logical contaxt and no correction is made. The Intel ifort compiler accepts integer values in logical contexts. fpt may be instructed to accept this usage by the command ACCEPT USE OF INTEGER FOR LOGICAL.

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 Yes

Default

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

Examples:

The code:

STATUS=LIB$GET_LUN(ICH) IF (.NOT. STATUS) CALL LIB$SIGNAL(%VAL(STATUS))

where STATUS is an integer variable, is corrected:

when REPRESENT TRUE BY LEAST SIGNIFICANT BIT is selected:

STATUS=LIB$GET_LUN(ICH) IF (.NOT. (IAND(STATUS,1) .NE. 0)) CALL LIB$SIGNAL(%VAL(STATUS))

when REPRESENT TRUE BY SIGN BIT is selected:

STATUS=LIB$GET_LUN(ICH) IF (.NOT. (STATUS .LT. 0)) CALL LIB$SIGNAL(%VAL(STATUS))

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