HP Fortran Programmer Guide (766160-001, March 2014)
Miscellaneous
Following are miscellaneous incompatibilities between HP Fortran and HP FORTRAN 77:
• The syntax and functionality of the HP Fortran version of the ON statement is different from the
HP FORTRAN 77™version. For example, ON EXTERNALand ON INTERNAL are not supported
in HP Fortran™. For information about using theONstatement, see the “Using the ON statement”
(page 81).
• HP FORTRAN 77™ accepts statement functions that convert arguments; HP Fortran™ does
not.
• HP FORTRAN 77™ accepts the { character as comment syntax; HP Fortran does not.
• HP FORTRAN 77™ accepts a PROGRAM statement with no name; HP Fortran requires the
name.
• HP FORTRAN 77™ extends the PROGRAM statement to enable access to command-line
arguments; HP Fortran does not. For information about how to use intrinsics to access
command-line arguments, see “Accessing command-line arguments” (page 107).
• HP FORTRAN 77™ supports arrays up to rank 20; HP Fortran supports arrays up to rank 7.
• HP FORTRAN 77™ accepts an expression like +-A, but HP Fortran generates a syntax error.
Use +(-A) instead.
• HP FORTRAN 77™ does not print leading zeroes in floating-point numbers; HP Fortran™
does. This behavior is equivalent to compiling an HP FORTRAN 77™ program with the +E4
option (note that this option is not supported by f90).
• In HP FORTRAN 77™, integers that overflow (through initialization or constant folding) are
replaced with the maximum value for that type. If HP Fortran™ detects integer overflow, it
treats it as an error; if it does not detect it, the overflow value is truncated at runtime.
Migration issues
Migration issues fall into four general categories:
• Source code issues
• Command-line option issues
• Object code issues
• Data file issues
Source code issues
For standard-conforming HP FORTRAN 77™code, migration to HP Fortran can be as simple as
recompiling with the f90command. The f90command accepts source files with the extensions .f
and .F(among others).
However, source code is likely to be the main obstacle on the migration path to HP Fortran. The
reason is that HP FORTRAN 77™ supports a number of compiler directives and intrinsic functions,
some of which are supported by HP Fortran, but others of which are either unsupported or have
changed. The following sections discuss how to change directives and intrinsics when migrating
HP FORTRAN 77™source code to HP Fortran.
NOTE: HP FORTRAN 77™accepts (or forgives) a number of common but nonstandard
programming practices that HP Fortran does not. These nonstandard practices as well as all known
incompatibilities between HP FORTRAN 77™and HP Fortran are listed in “Incompatibilities with
HP FORTRAN 77” (page 131).
Migration issues 135