GFORTRAN
The GFORTRAN Compiler for FORTRAN90 code


GFORTRAN is the Gnu compiler for the FORTRAN language family. In particular, GFORTRAN can compile files written in the FORTRAN90 language.

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

Related Data and Programs:

C examples which illustrate features of the C language.

C++ examples which illustrate features of the C++ language.

F77 examples which illustrate features of the FORTRAN77 language.

F90 examples which illustrate features of the FORTRAN90 language.

F90_INTRINSICS examples which illustrate the use of FORTRAN90 intrinsic functions.

G95_INTRINSICS examples which illustrate the use of intrinsic functions peculiar to the G95 FORTRAN compiler.

GFORTRAN_INTRINSICS is an executable FORTRAN90 program which demonstrates the use of some of the intrinsic functions included with the GFORTRAN compiler.

MAKEFILES examples which show how to use makefiles with a set of FORTRAN90 files.

matlab examples which illustrate features of MATLAB.

MIXED examples which show how to write a program partly in FORTRAN90 and partly in some other language.

MPI examples which show how to set up parallel programs in FORTRAN90.

TIMER examples which show how to compute elapsed CPU time in FORTRAN90.

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

Reference:

  1. GNU,
    GFORTRAN Reference Manual,
    gfortran.pdf.

Examples and Tests:

BIG_INTS shows how you can use the new KIND qualifier to create, for example, really big integers.

BINARY_TREE shows how a binary tree can be defined and manipulated, using the FORTRAN90 "POINTER" type.

CHAR_ALLOC shows that in FORTRAN90 it is possible to declare an allocatable array of characters, for which the dimension is not specified in advance. Note, however, that the "length", that is, the "LEN" parameter, must be specified explicitly. It is not possible to make the "LEN" parameter "allocatable" until FORTRAN2003.

CONSTANT_TYPE shows that FORTRAN90 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 use the new KIND qualifier to create and use variables of type "double precision complex".

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.

LINKED_LIST shows how a linked list can be defined, using the FORTRAN90 "POINTER" type.

MATRIX_FUNCTION_TEST shows how you may now define a function whose return value is a matrix.

MAXMIN_TEST shows the use of the very useful MAXVAL and MINVAL operators for vectors and arrays, and the so-very-fussy and hence maddeningly useless operators MAXLOC and MINLOC.

MXM multiplies two matrices using the MATMUL intrinsic.

RANDOM_PRB demonstrates the random number routines.

RANDOM_TEST tests the random number routines.

READ_VARIABLE_RECORDS shows how to read lines of data when you don't know how many items are on each line. We're assuming that every item is in "I4" format, but the number of such items variables from line to line.

REAL_KIND shows how to declare real data types of various precision, and to inquire about their properties.

RECURSIVE_FUN_TEST shows how you can use recursion in a function definition.

RECURSIVE_SUB_TEST shows how you can use recursion in a subroutine definition.

SGE_MOD tries to set up an interesting example of the use of modules. In this case, the idea is that a set of linear algebra routines will share a module that stores the value of a matrix, its LU factor and determinant, and also knows which of these items have been computed. This hides a lot of information from the user, and makes for simple calls.

SORT_TEST bubble-sorts a real vector.

WHERE_TEST demonstrates the WHERE statement.

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


Last revised on 05 February 2008.