fpt and WinFPT Reference Manual - Command-line Commands
| SimCon Home | Ref Manual Home |
ACCEPT COERCION OF INTEGER TO LOGICAL
Syntax:
[DO NOT] ACCEPT INTEGER COERCION TO LOGICAL [DO NOT] ACCEPT COERCION [OF] INTEGER TO LOGICAL [DO NOT] ACCEPT USE OF INTEGER FOR LOGICAL
Function:
Many compilers allow integer variables to be used in a logical context. This is particularly true of the DEC heritage compilers, VMS, CVF, HP-UX, ifort and ifx. This command specifies whether fpt will allow the usage without flagging an error.
Coercion of integers to logicals is non-standard and different systems use different conventions. The DEC heritage systems all use the least significant bit of the integer to indicate .TRUE. or .FALSE. Other systems use non-zero or zero, or positive or negative. When fpt evaluates a logical expression which contains an integer coerced to a logical the convention is controlled by the command REPRESENT .TRUE. BY. fpt can also correct the use of integers in logical contexts by inserting code to generate the logical value. The command is CORRECT USE OF INTEGER FOR LOGICAL.
In some legacy codes it was common practice to use logical variables, in particular LOGICAL*1 variables, to hold integer values. fpt may systematically change all LOGICAL*1 declarations to INTEGER*1. The command is CHANGE LOGICAL*1 TO INTEGER*1. When this command is made fpt also accepts coercion of integer to 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 | No |
| Interactive command files | No |
| Embedded in the Fortran code | Yes |
Default
By default fpt does not accept the coercion and flags a diagnostic.
(Note that defaults may be changed in the configuration file)
Copyright ©1995 to 2026 Software Validation Ltd. All rights reserved.