Fortran Compilers

There are several free compilers available or up-coming for Unix-like operating systems that support modern Fortran language standards:

GNU Fortran (gfortran)
Modern Fortran compiler, part of the GNU Compiler Collection and successor of g77.
Flang
Front-end for LLVM, with limited support of the Fortran 2003 and 2008 language standards. Based on source code of PGI.
Flang/F18
LLVM front-end for Fortran 2018 in development, contributed by NVIDIA.
LFortran
A Fortran 2018 REPL-like front-end for LLVM, in pre-alpha stage.
FC
Another Fortran 2018 front-end for LLVM 10 by CompilerTree, in development.
Intel oneAPI
Intel’s Fortran, C, C++, and Python compilers for Windows, Linux, and macOS (freeware).
IBM XL Fortran
Proprietary no-charge full-function Community Edition of IBM’s Fortran compiler for Linux.

GNU Fortran is a fork of G95, a discontinued Fortran 95 compiler that has been removed from the FreeBSD ports collection due to deprecated dependencies that are required for building. Flang in an older front-end for LLVM, missing most features of Fortran 2008 and 2018.

Fortran compilers are available for many platforms. Most of them target Microsoft Windows and/or Linux, but do not produce native binaries for FreeBSD and other Unix systems, like Intel Fortran, PGI Community Edition, or the abandoned Open64.

Some historic compilers for FORTRAN 77 are open-source as well:

Proprietary compilers targeting CP/M, DOS (fig. 1), and Microsoft Windows can be downloaded from various web sites dedicated to historic software, like old-dos.ru or winworldpc.com.

Microsoft FORTRAN Compiler for DOS
Fig. 1: Box of Microsoft FORTRAN Compiler for DOS

Online Compilers

There are services that provide online access to Fortran compilers, to build and run Fortran programs through the web browser, like:

You may want to try some of the examples in the next sections by using an online compiler.

Modern Fortran on FreeBSD

Using FreeBSD as a programming environment for modern Fortran currently limits the list of available compilers to GNU Fortran and Flang, as Flang/F18 is still in early stage. All three can be installed from ports or by using the FreeBSD package manager. The Intel Fortran compiler for FreeBSD was removed from the ports collection in 2010.

References