HP Fortran Programmer's Guide (September 2007)

Porting to HP Fortran
Using porting options
Chapter 11242
NOTE The name-conflict problem can occur in Fortran programs that call routines in
the libU77.a library. Some implementations link libU77.a by default.
HP Fortran does not; to link in this library, you must compile your program
with the +U77 option. If you do not compile with this option and your program
references a libU77 routine with the same name as an HP Fortran intrinsic,
the compiler will wrongly (and sometimes disastrously) assume that the
reference is to an intrinsic.
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 217 ***.
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 183.
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: