HP Fortran Programmer Guide (766160-001, March 2014)

11 Porting to HP Fortran
The goal of portability is to make it possible to compile and execute a program on different vendors
platforms, regardless of the platform on which it was written. A portable Fortran 90 program
contains no language elements except those mandated by the Standard and adheres to generally
accepted coding practices.
In practice, however, programming is rarely so simple. Many Fortran programs have a long history
and were originally coded at a time when portability was not a concern because many programs
were written to execute on one platform only. Older Fortran programs—so-called dusty-deck
programs—are likely to have passed through different dialects of Fortran, picking up features from
each, even after those features have become outmoded. Porting such a program may sometimes
be as simple as identifying and removing the nonportable features. But more often than not, it
involves finding ways to implement the functionality of the nonportable features.
To make the task of porting easier, HP Fortran includes the following features:
Language extensions—statements, data types, directives, and intrinsic functions—that are
compatible with other Fortran implementations.
Compile-line options to help with the porting process.
This chapter includes the following sections:
Compatibility extensions
Using porting options
NOTE: For information about migrating HP FORTRAN 77™ programs to HP Fortran, see
“Migrating to HP Fortran” (page 131).
Compatibility extensions
HP Fortran includes a variety of extensions to the Fortran 90 language. Most of these are
compatibility extensions—statements, intrinsic routines, and compiler directives that are specific to
nonstandard implementations of Fortran 90. For example, if you are porting a program that contains
the ACCEPTstatement, you do not have to edit the part of the program that contains this nonstandard
statement because it is one of the compatibility extensions of HP Fortran.
The following sections describe the compatibility extensions. For a list of all HP Fortran language
extensions, see the HP Fortran Programmer’s Reference.
Except for the ON statement (see “Using the ON statement” (page 81)), all of the nonstandard
statements supported by HP Fortran are provided for compatibility. These are listed by vendor in
Table 11-1. Check the description of each statement in the HP Fortran Programmer’s Referenceto
confirm compatibility.
Table 42 Compatibility statements
DescriptionImplementationStatement
Reads from standard input.DECACCEPT
Allocates storage on the stack.SunAUTOMATIC
Declares entities of type integer.DECBYTE
Inputs formatted data from internal storage.Earlier versions of FortranDECODE
Declares entities of type double complex.Earlier versions of FortranDOUBLE COMPLEX
Outputs formatted data to internal storage.Earlier versions of FortranENCODE
Terminates the definition of a structure or union.DECEND (structure definition)
Compatibility extensions 141