Fortran 2018 compiler standard enforcement

Both Gfortran and Intel Fortran compilers have options for enforcing the Fortran 2018 standard. The compilers raise additional warnings or errors for code that is not deemed compliant with the Fortran 2018 standard.

Gfortran

Gfortran 8 added -std=f2018 option to enforce Fortran 2018 standard support.

For Ubuntu, the latest Gfortran is obtained from the Ubuntu-test PPA. In general, Linux, MacOS and Windows Subsystem for Linux can get the latest Gfortran via Homebrew.

At minimum a modern Fortran program should use these Gfortran options:

gfortran -std=f2018 -Wall -fimplicit-none

PGI

The PGI Fortran compiler pgfortran is building up Fortran 2018 standard compliance. In general, one should uniformly enforce implicit none via:

pgfortran -Mdclchk

Intel Fortran

The currently supported Intel compilers should be used with at least these options for modern Fortran programs:

Linux / MacOS

ifort -stand f18 -implicitnone -W1

Windows

ifort /stand:f18 /4Yd /W1