SECTION F. COMPILER FEATURES AND PECULIARITIES

There are several very usable Fortran compilers by Lahey. The older EM/32 compiler is still quite wonderful and I use it a lot. It is a Fortran 77 compiler with some Fortran 90 features. It allows you to build executable files that are exportable to installations that themselves do not have this compiler with the following command line statements:


f77l3 myprog.for
386link myprog -lib mylib.lib,dosx -stub runb

You should also note that one principal difference between Lahey compilers LF90 and LF95 is that the former generates .exe files that will run in a purely DOS environment, i.e., on computers that do not have Windows 95, but the latter generates executable files that will not run without Windows 95.

Generally speaking, compilers are not equally "forgiving." I have found that all the PC-based compilers (EM32, LF90, LF95, Digital Visual Fortran, and WATCOM) are quite forgiving, although in some respects they are also more stringent than Unix compilers. The same can be said for the RS/6000 xlf compiler. This is not the case for the SunOS f77 compiler, the Solaris f90 compiler, or the DEC Alpha f90 compiler.

Example in which PC compilers are more stringent:

Consider the following code:

C      MAIN Program
       ........
       call sub(a,b,c,d,e)
       ........
       call sub(a,b,d,e)
       ........
C      End of MAIN

PC-based compilers typically complain that the second call does not match the first one.

Examples in which PC compilers are less stringent:

1. In the following example, the Sun compilers (both under SunOS and Solaris) and the DEC Alpha compiler compile the code without diagnostics and generate a .o file; but if you execute the code, the run aborts with the "Segmentation fault" message and a core dump takes place.

C      MAIN program
	   parameter (n=32)
	   dimension mat(2,n/2)
	   ...........
	   call sub(a,b,c,mat)
	   ...........
C      End of MAIN program
	   subroutine sub(a,b,c,mat)
	   dimension mat(2,30)
	   ...........
	   return
	   end

The reason that this is curious is that arrays are stored column-wise and while the first dimension matters a great deal, the second dimension should not matter at all in the definition of the subroutine.

2. In this example, the DEC Alpha compiler generates no error diagnostic, but when the crucial instruction is executed, the run abort with segmentation fault.

C       MAIN program
	    parameter (n=32)
		..........
		call sub(a,b,n)
		..........
C       End of MAIN
	    subroutine sub(a,b,n) 
		..........
C >>>>>>>>>>>> Note following statement <<<<<<<<<<<<
	    n=2*(n/2)
		..........
C       End of subroutine

When the indicated statement is executed, the program aborts.

Return to the Beginning