Instructions for running Fortran


fort -fast -o test test.f90
There is a bug in Compaq Fortran 90 on Linux. Use the following module in your Fortran 90 programs. It should fix the unalligned access problem.
module signals_fix
  public :: fix_signals

  subroutine fix_signals()
    integer :: signal, ret
    integer :: i

    do i = 1,17
       ret = signal ( i, 0, 0 )

  end subroutine fix_signals
end module signals_fix

program foo
  use signals_fix

  call fix_signals()
! rest of program goes here.
end program foo


Make a separate directory for your F files because F generates extra files. Because the syntax of Fortran 90 is more forgiving than F, first compile your program using the Fortran 90 compiler.

Suppose that the name of your program is foo.f90. (Note the f90 extension.) Your program can be compiled by typing

f90 -n32 -o foo foo.f90
If there are no errors, type foo to run the program.

Alternatively, you can run your program using the Fortran 90 compiler with the F extension by typing

f90 -n32 -freeform -o foo foo.F
If you have reduced your errors to a few, name your file foo.F, and compile your program by giving the command:
F -o foo foo.F
The errors are in F.err.

To compile a module only, for example common_module.F, type

F -c common_module.F
You can edit your files with an editor such as emacs. A summary of some of the basic commands is available.

After you are have tested your program and removed all syntax errors, run your program with the Fortran 90 compiler. To optimize the compilation of your program, type

f90 -n32 -O2 -o foo foo.f90

Power Macintosh, OS9

The version of F on the Macintosh has a few bugs, but they are only a nuisance. If you input data from the keyboard, type enter instead of return. (The correct way should be return.)

Versions of F also are available for Linix (no cost), Unix workstations, and Windows 95. Information is also available at the Fortran store. A simple introduction to F with sample programs is available.

Please send comments and corrections to Harvey Gould,

Updated 13 December 2001.