HP Fortran Programmer's Guide (March 2010)
Migrating to HP Fortran
Approaches to migration
Chapter 10242
The main drawback of f90 as a migration tool is that a clean compilation under f90 does not
guarantee that all incompatibilities have been found; some do not manifest themselves until
runtime. Also, linking under f90 with f77-generated object files may yield unexpected
behavior or incorrect results; see “Object code issues” on page 239 and “Data file issues” on
page 240.
In addition, the f90 command sometimes reports incompatibilities — especially in
syntax—one at a time. Needless to say, fixing incompatibilities one at a time and recompiling
after each fix may not be the most cost-effective approach to migrating a large FORTRAN 77
program to HP Fortran.
Lintfor
The lintfor tool can be used on HP FORTRAN 77 code to detect semantic assumptions that
may not be valid for HP Fortran code. However, lintfor does not accept the Fortran 90
grammar and therefore has the same drawbacks as the f77 command.
Fortran incompatibilities detector
The Fortran Incompatibilities Detector (fid) is an HP-supplied tool that was developed
specifically to help in migrating HP FORTRAN 77 code to HP Fortran. It is located in:
/opt/fortran90/contrib/bin/fid
fid searches the target source-code file for various HP FORTRAN 77 extensions that are
known to be incompatible with HP Fortran. It also detects incompatible command-line
options when given an f77 command line. fid reports both source-code and object-code
incompatibilities between HP FORTRAN 77 and HP Fortran. Furthermore, if fid detects an
incompatible extension whose functionality is enabled by some other means in HP Fortran, it
will suggest a fix.
fid works by searching the entire program and reporting all its findings at once. Like the f77
command, it expects the target program to conform to HP FORTRAN 77 syntax and will
report syntax errors along with incompatibilities it detects. Unlike f77, however, if fid
encounters a syntax error, it attempts to recover and continue parsing the rest of the program.
This recovery mechanism allows fid to accept programs that contain HP Fortran language
features.
Not all incompatibilities are on fid's detection list. Some cannot be found by any automated
means, and others require too much time to compute for even medium-sized programs.
To invoke fid, supply the fid command with one or more FORTRAN 77 source files and any
desired f77 options. If a file has been partially migrated to HP Fortran, change its extension
to .f for use with fid. Following are example command lines:
$ fid +800 file.f
$ fid +es program.f