fpt and WinFPT Reference Manual - Command-line Commands

| SimCon Home | Ref Manual Home |

CORRECT I/O STATEMENT ARGUMENTS

Syntax:

[DO NOT] CORRECT I/O STATEMENT ARGUMENTS [DO NOT] CORRECT ARGUMENTS TO I/O CONTROL LISTS

Function:

Many of the arguments in I/O control lists are required by the Fortran Standard to be integers of the default integer kind. If a different integer kind or real varable is used, for example, in UNIT= or REC= specifications the result may be:

All of these cases have been seen by the authors.

This command instructs fpt to change the control-list argument to the correct type and kind.

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 change is made by default.

Example

In the test program shown below the logical unit number is an integer of kind=1, under ifx or gfortran, a single byte.

PROGRAM t_correct_io INTEGER(1) i1 /1/ OPEN (UNIT=i1,FILE="i1.txt",STATUS='UNKNOWN') WRITE(i1,'("File: i1.txt")') CLOSE(i1) END PROGRAM t_correct_io

This is corrected to a default integer:

PROGRAM t_correct_io INTEGER(1)i1/1/ INTEGER*4 fpt_unit !-------------------------^---------------------------------------------------- !!! FPT - 4243 Declaration inserted by fpt !------------------------------------------------------------------------------ ! FPT OPEN (UNIT=i1,FILE="i1.txt",STATUS='UNKNOWN') fpt_unit=i1 OPEN (UNIT=fpt_unit,FILE="i1.txt",STATUS='UNKNOWN') !--------------------------^--------------------------------------------------- !!! FPT - 4287 I/O statement argument changed to standard type and kind !------------------------------------------------------------------------------ ! FPT WRITE (i1,'("File: i1.txt")') fpt_unit=i1 WRITE (fpt_unit,'("File: i1.txt")') !----------------------^------------------------------------------------------- !!! FPT - 4287 I/O statement argument changed to standard type and kind !------------------------------------------------------------------------------ ! FPT CLOSE (i1) fpt_unit=i1 CLOSE (fpt_unit) !----------------------^------------------------------------------------------- !!! FPT - 4287 I/O statement argument changed to standard type and kind !------------------------------------------------------------------------------ END PROGRAM t_correct_io

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