HP Fortran Programmer's Guide (B3908-90031; September 2011)

Porting to HP Fortran
Using porting options
Chapter 11248
If you are not sure if your program references libU77 routines, compile it with the
+langlvl=90 option, which will cause the compiler to issue warnings for references to
nonstandard routines. For problems that can occur when migrating HP FORTRAN 77
programs that reference libU77 routines, see *** 'Intrinsic functions' on page 222 ***.
Names with appended underscores
In some implementations of Fortran (but not HP Fortran), the compiler automatically appends underscores
to external names. If you are porting a mixed-language program from such an implementation (for example,
a program consisting of C and Fortran source files), the linker may not be able to find the names in the C
code because the names in the Fortran code do not have the appended underscore. The reason is that the C
code has explicitly added underscores to match the names of the Fortran procedures in the object code.
Using the +ppu option causes the HP Fortran compiler to append an underscore to external names
(including procedures and common blocks), making them consistent with the name as it appears in the
non-Fortran source file. For example, if a Fortran source file contains the procedure proc_array, and a C
source file reference this procedure as proc_array_, compiling the Fortran source file with the +ppu
option causes the compiler to use proc_array_ as the name of the procedure in the Fortran object file.
For information about how to resolve other name conflicts in mixed-language programs, see “Case
sensitivity” on page 188.
Source formats
Standard Fortran 90 permits source code in either fixed or free form, though not both in the same file.
Furthermore, if the source is in fixed form, the Standard requires statements not to extend beyond column
72. Also, Standard Fortran 90 does not allow tab formatting.
HP Fortran’s scheme for handling the different formatting possibilities is this:
If the name of the source file ends with the .f90 extension, the file is compiled as free form. The
compiler accepts tab characters in the source.
If the name of the source file ends with the .f or .F extension, the file is compiled as fixed form.
If the file is compiled with the +langlvl=90 option, the interprets the format as either fixed or free
form, depending on the filename extension (as described above). However, the compiler issues
warnings if it encounters tab characters.
If the file is compiled with the +source=fixed option, the compiler assumes fixed form, regardless of
the extension. Tab characters are allowed.
If the file is compiled with the +source=free option, the compiler assumes free form, regardless of
the extension.