Porting EM/32 Programs to LF90From the Lahey Solutions Staff
1. IntroductionThis porting guide recommends steps to move Fortran programs from F77L-EM/32 to Lahey Fortran 90, LF90. The intended audience is the EM/32 user; however, the suggestions should work when porting from any Lahey language system.
For the most part, compiled object and library program units are incompatible between EM/32 and LF90. Therefore, we strongly recommended all program units and libraries be recompiled.
LF90 is a 32-bit high-performance Fortran 90 language system targeted for Intel's Pentium and Pentium Pro Processors. LF90 also generates quality code for the 80386 and 80486 chips. LF90 does not support EM/32 features that reduce performance nor does it support technology that has not kept up with Intel's chip evolution. In general, all currently non-documented (accidental) extensions are not supported in LF90
The steps detailed below begin with setting a goal and finish with the program executing under LF90. Section 8 is an inventory of incompatibilities between EM/32 and LF90 and the associated actions to correct them.
If you believe something should be a part of this guide, please call Lahey Solutions and let us know - it will be appreciated.
For more detailed information towards adopting Fortran 90, Lahey offers
Migrating to Fortran 90, by
James F. Kerrigan for $27.95 plus shipping and handling.
2. Porting ProcedureThis guide is intended more as a guide than a cookbook; individuals should feel free to make changes (possibly even ignore suggestions) appropriate to their way of doing things.
2.1 Decide upon a goal. 1) Cleaner, more portable, FORTRAN 77 source code (which could also be used for EM/32) or 2) moving code towards Fortran 90 by beginning to introduce Fortran 90 features into the code.
Your goal affects, see below, what changes are made to EM/32 source files.
2.2 Make backup copies of all EM/32 source and data files.
2.3 Choose an extension for fixed-format source files, .for (same as EM/32) is suggested. The extension can be anything but .f90 which is the default to denote the other Fortran 90 source form: free. Rename the EM/32 fixed-format source files to the chosen extension.
2.4 Using FFTOSTD.EXE (provided with EM/32), convert EM/32
free-format source files to Fortran 90
fixed-format source (same as FORTRAN 77) using the extension decided
upon above. This is necessary
because the Fortran 90 Standard supports a free-format source format
that conflicts with the free form
2.6 Using EM/32, compile the fixed-format files using the /C/H/L/X options. These options cause a source listing with cross-reference information to be generated and non-conformance with the FORTRAN 77 Standard noted. Non-standard features are noted with one of the following messages:
WARNING - Non-standard FORTRAN 77 usage (see FORTRAN 77 extensions in Lahey Language Reference Manual index).
WARNING - Non-standard Fortran 77 usage, a Fortran 90 feature (see Fortran 90 features in Lahey Language Reference Manual index).
Since the compiler is unable to report every incompatibility, see "FORTRAN 77 extensions" and "Fortran 90 features" in the EM/32 Language Reference.
2.7 Link and execute the EM/32 program. Then execute the program with redirection of output, e.g.,
This .77 file will be used to compare with LF90 output to help ensure the program has been ported successfully.
2.8 Make backup copies of all the new (if any) EM/32 source files.
2.9 Install LF90, follow the directions on the screen.
2.10 Port and compile the source files.
2.11 Create the executable file and capture the output; use the extension ".90".
2.12 Compare the .77 and .90 files. Due to different
code generation algorithms in EM/32 and LF90,
numbers might not compare due to round off. Other than this,
the files should compare. If not, carefully
review the changes that have been made and repeat these last three
steps until the port has been
3. Driver (LF90.EXE)Depending on the command-line options, the driver invokes the compiler, library manager, and linker to compile source files, create module libraries, and bind objects and libraries to create an executable file. More than one source file and/or object file may be specified. To use the driver to compile a source file to an object file without invoking the linker, use the -c option.
Type "LF90" with no arguments to list the command-line syntax and optional
arguments. See the LF90
User's Guide for the complete description of the Driver.
4. Fig Converter (CNVFIG.EXE)Lahey FORTRAN 77 compilers (*.FIG) and LF90 (LF90.FIG) have different sets of options with different syntax for specifying the option. To facilitate this change, LF90 includes CNVFIG, an executable that converts existing *.FIG files into an LF90.FIG in the same directory. CNVFIG either
maps each option into the corresponding LF90 option or the option is eliminated. The first list of options (from all the Lahey compilers) below are eliminated; the second list are converted as noted.
4.1 Eliminated Options
4.2 Translated Options
Three /n options are not listed above: /nd (maps to -hed), /nf (maps to -fix), and /nz1 (maps to -o1).
For a complete description of the LF90 options, including the default
values, see the LF90 User's Guide.
5. Make Utilities and makefilesMake utilities and makefiles are used for managing larger software projects where there are many source files, header files, and libraries, often scattered among different directories. While the compiler itself will unconditionally compile all files, the Make utility will only compile files that have been changed recently (along with other files that depend on them), resulting in considerable time savings. Beginning with version 3.50, the LF90 compiler is being distributed with a new Make utility called Automake, written by Polyhedron Software Ltd. Automake has certain advantages over the old Make utility written by Opus Software, but some users may wish to retain their use of the old Make. Note that the .f90.exe inference rules are already known to both Make utilities.
5.1 Opus MAKE (MAKE.EXE)
If your makefile uses compiler response files, you'll need to change the following lines as well:
5.2 AUTOMAKE (AM.BAT)
To set up Automake for a large project with components in multiple directories, it is easiest to copy all components of the project into a single (temporary) directory and run AM so it can figure out the dependencies. You can then copy the resulting AUTOMAKE.DEP file over to your working directory. You will also need to copy the file \LF9035\BIN\AUTOMAKE.FIG into the working directory and edit it so that the placemarkers for the various components describe the actual paths of those components.
Chapter 6 of the LF90 User's Guide and the file AUTOMAKE.FIG provide
sufficient information on
using Automake should you choose to use it.
6. LINKER (386LINK.EXE)Under LF90, the linker is automatically run by the driver unless you specify -c, compile only.
If you submit filenames to the driver with the extension .obj, the driver will only run the linker.
The driver will read linker command files except for the following imcompatibilities:
- Comment lines must begin with a # in column
7. Library Manager (LM.EXE)The Library Manager (LM.EXE, distributed with LF90 v3.50 and above) provides the same functionality as the PharLap Librarian (386LIB.EXE), although command syntax and options are different. The following is a list of differences and/or equivalences between 386LIB and LM.
7.1 Command Files
7.2 386LIB Environment Variable
7.3 Command Line Syntax
8. User ActionsWhat follows is an inventory of incompatibilities between EM/32 and LF90. Actions must be taken to remedy each of them. There are six sections below; each section requires a different action for the group of incompatibilities.
8.1 Hardware Not Supported
8.1.1 80287 coprocessor
8.1.2 Weitek coprocessor
8.2 RPC interface
8.3 Source Code Extension Changes
8.3.1 NARGS, number of arguments passed to a program unit.
SUBROUTINE S(a, b, c)
change the code to use the Fortran 90 intrinsic PRESENT
SUBROUTINE S(a, b, c)
8.3.2 VAX Extensions
8.3.2 NAMELIST Statement
NAMELIST /mylist/ a, b, c
But would have to be changed in LF90:
INTEGER a, b, c
8.4 Source Code Extension Eliminations
8.4.1 Hollerith constants. LF90 support is limited
to within the FORMAT Statement.
8.4.2 Character declaration. LF90 does not support
8.4.3 EM/32 allows statement function actual arguments
to differ in type from the dummy arguments.
LF90 doesn't allow it.
8.4.4 Generic intrinsics. LF90 does not allow SIN
(int), etc., and mixed types with MAX, MIN, MOD,
8.4.5 Non-Integer Numerics. LF90 does not allow non-integers
in computed goto, subscripts, substrings,
unit numbers, etc.
8.4.6 ALLOCATE Statement. STAT= specifier
8.4.7 IF (nonCOMPLEX numeric exp) [label],[label],[label]
Arithmetic IF may be removed from the Fortran Standard
8.4.8 Statement label without an executable statement
8.4.9 Substring of parenthetical expressions and function results
char_temp = charexpression
Where: char_temp is a CHARACTER scalar of appropriate length
8.4.10 Declarations appearing after the first executable statement
8.4.12 HC EXTERNAL
8.4.13 OPEN Statement. ACTION=READ/WRITE
8.4.14 IOSTAT/STAT numbers are different.
8.5 Non-Standard Changes
8.5.2 OPTION BREAK(label), OPTION BREAK[(logical variable)]
and OPTION NBREAK
8.6 Changes That are not required
8.6.1 CALL TIME(result)
Where: char_temp is a CHARACTER scalar of at least length 9
8.6.2 CALL DATE(result)
Where: char_temp is a CHARACTER scalar of at least length 8