GFORTRAN
The GFORTRAN Compiler for FORTRAN77 code


GFORTRAN is a directory of FORTRAN77 programs which illustrate the use of the Gnu GFORTRAN compiler.

This web page investigates the relationship between GFORTRAN and FORTRAN77, especially questions involving the implementation of the various arithmetic precisions.

Licensing:

The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.

Languages:

GFORTRAN examples are available in a FORTRAN77 version and a FORTRAN90 version.

Related Data and Programs:

C, C programs which illustrate features of the C language.

C++, C++ programs which illustrate features of the C++ language.

F77, FORTRAN77 programs which illustrate features of the FORTRAN77 language.

F90, FORTRAN90 programs which illustrate features of the FORTRAN90 language.

F77_INTRINSICS, FORTRAN77 programs which illustrate the use of FORTRAN77 intrinsic functions.

GFORTRAN_INTRINSICS, a FORTRAN77 program which demonstrates the use of some of the intrinsic functions included with the GFORTRAN compiler.

MAKEFILES, FORTRAN77 programs which show how to use makefiles with a set of FORTRAN77 files.

MIXED, FORTRAN77 programs which show how to write a program partly in FORTRAN77 and partly in some other language.

MPI, FORTRAN77 programs which show how to set up parallel programs using the message passing interface.

TIMER, FORTRAN77 programs which show how to compute elapsed CPU time in FORTRAN77.

TIMESTAMP, a FORTRAN77 library which shows how to get a timestamp in FORTRAN90.

Reference:

  1. The Gnu FORTRAN page, http://www.gnu.org/software/fortran/fortran.html .
  2. The GFORTRAN Manual, http://gcc.gnu.org/onlinedocs/gcc-4.6.0/gfortran.pdf.

Examples and Tests:

BOUNDS shows GFORTRAN can help you catch illegal array references. You need to compile with the "-fbounds-check" switch, and your program needs to correctly declare the dimensions of your arrays. You can't declare an array to be of size (*) or size (1), or allocate it as (10) in the calling routine and then declare it to be of size (20) in a routine to which it is passed!

CONSTANT_TYPE shows that FORTRAN77 constants have a type, and that if you don't specify it for real values, the default will be single precision.

DIGITS investigates how many digits you can usefully specify for data.

DIVISION shows that, if you're expecting double precision accuracy, you need to specify your constants carefully, as double precision values.

DOUBLE_COMPLEX shows how you can declare "double precision complex" values.

EXPONENT_FORMAT_OVERFLOW shows that (at least some) FORTRAN compilers cannot properly print real numbers with exponents of magnitude greater than 99. This becomes an especially serious problem if you write a very large or very small number out, and then read it back in, only to find that it has suddenly entirely lost its exponent, and now has magnitude roughly 1!

HELLO is just a "Hello, world!" program.

SORT_TEST bubble-sorts a real vector.

You can go up one level to the FORTRAN77 source codes.


Last revised on 04 December 2008.