SimCon logo

SimCon - Fortran Analysis, Engineering & Migration

  FPT Reference ManualDownloadsLicensingHome

 
 
 
 
 
FPT - Automatic Correction of Fortran Errors
 
Error Correction
 

FPT identifies errors and inconsistencies in Fortran codes (Please see the Quality Assurance page). It may also be also be used to correct some classes of error automatically. The most important corrections are to sub-program arguments. For example:

ALPHA = ACOS ( BOUND ( 0, HDOT / V, 1 ) )

The function BOUND is a limiter, which is used to keep the input to ACOS within the range zero to one. It is coded as:

FUNCTION BOUND( LOW, INPUT, HIGH ) REAL LOW,INPUT,HIGH BOUND = MIN ( HIGH, MAX ( LOW, INPUT ) ) RETURN END

The problem here is that all three arguments to BOUND should be real, but BOUND has been called with the arguments integer 0, real HDOT/V and integer 1. The integer value of zero is unlikely to cause a problem. Most systems treat integer zero as equivalent to real zero. The integer 1 will usually cause an error.

The FPT command to correct problems like this is 'Correct inconsistent arguments'. FPT checks all arguments in the entire program. Corrections are made by re-writing the arguments or by inserting calls to intrinsic functions (e.g. REAL(), DBLE(), INT() etc.). Inconsistent arguments which cannot be corrected are marked by diagnostics.

The call above is re-written as:

ALPHA = ACOS ( BOUND ( 0.0, HDOT / V, 1.0 ) ) !------------------------------^--------------^--------------------------- !!! FPT - 1873 Actual argument has been changed to match formal argument. !!! FPT - 1873 Actual argument has been changed to match formal argument. !-------------------------------------------------------------------------

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