A common problem in porting Fortran programs is name conflicts: a
One way to identify user routines that have the same names as
The following are programs that illustrate the preceding concepts.
Example 34 Example
PROGRAM clash i = 4
j = int1(i) PRINT *, 'j =', j END PROGRAM clash FUNCTION int1(i) int1 = i+1
END FUNCTION int1
If this is compiled as coded and without the +langlvl=90option, the compiler will assume that the reference is to the HP intrinsic named INT1and not to the external function. Executing the program will produce unexpected results, as appears in the following sample run:
$ f90 clash.f90 clash.f90 program CLASH external function INT1 11 Lines Compiled
$ a.out j = 4
If the program is recompiled with the +langlvl=90option, the compiler flags the name of what it assumes to be a nonstandard intrinsic as well as the nonstandard source format:
$ f90 +langlvl=90 clash.f90 program CLASH
i = 4
^
Warning 4 at (3:clash.f90) : Tab characters are an extension to standard
j = int1(i)
^
Warning 39 at (5:clash.f90) : This intrinsic function is an extension to standard
external function INT1 int1 = i+1
^
Warning 4 at (10:clash.f90) : Tab characters are an extension to standard
11 Lines Compiled
Once you have identified the names of your routines that clash with intrinsic names, you can edit the source code to declare each procedure with the EXTERNALstatement, as follows:
EXTERNAL int1
Now when you compile and execute, you will get the expected behavior:
146 Porting to HP Fortran