GCC Gfortran and Intel oneAPI are the most advanced, widely available modern Fortran compilers.
Useful Fortran 2018 enhancements include:
assumed array rank,
to initialize random number seed, and
implicit none (type, external)
to require external procedures to be explicitly declared.
GCC 10 is the
Intel oneAPI has full Fortran 2018
To get recent GCC is usually straightforward. Red Hat should use GCC Toolset. MacOS Homebrew quickly adds the latest GCC version. If Ubuntu gfortran repo defaults aren’t adequate, get recent Gfortran via PPA.
Here are some of the major changes in Gfortran by version:
- Gfortran 12 enhances OpenMP 5 and OpenACC 2.6 support. Numerous bugfixes.
bind(C)with character length greater than one.
- Gfortran 11 completed OpenMP 4.5 support
- Gfortran 10 added
- Gfortran 9 added
random_init()to initialize the random generator seed.
- Gfortran 8 added automatic nested loop exchange with
do concurrent, actual argument array with too few elements for dummy argument now errors, initial support for parameterized derived types (simply define
kindat initialization) and coarray support for teams. Standard flag
-std=f2018added and deprecated
- Gfortran 7 added derived type IO
select type. Complete Fortran 2003 support, Fortran 2018 non-constant
error stopcodes, and
-fdec-options to help compile very old non-standard code.
Gfortran 6 added Fortran 2008
submodule support, useful for large projects to save compilation time and allow powerful
Fortran 2003 deferred-length
for avoiding bothersome
GCC 5 added full support for OpenMP 4.0, Fortran 2003
ieee_ intrinsics, Fortran 2008
error stop in
pure procedures with constant error code.
GCC 4.9 added Fortran 2003 deferred-length character variables in derived types.
GCC 4.8 supported Fortran 2008 polymorphism, including
type(*), and assumed rank
GCC 4.6 was the first version of Gfortran reaching beyond Fortran 95, with Fortran 2003 deferred-length character variable and Fortran 2008
impure elemental support.
GCC 4.5 added Fortran 2008
GCC 4.4 added initial support for polymorphism and OpenMP 3.
CMake allows switching parameters based on compiler version. This is very useful for modern Fortran programs.
CMakeLists.txt for Fortran compiler version dependent options.
if(CMAKE_Fortran_COMPILER_ID STREQUAL "GNU") add_compile_options( -Wall $<$<COMPILE_LANGUAGE:Fortran>:-fimplicit-none> ) endif() add_executable(myprog main.f90)
Reference: Gfortran changelog