Fortran 2018 compiler standard enforcement
Gfortran and Intel oneAPI 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.
It’s also important in code you’re responsible for to always use implicit none
so that each variable must be assigned beforehand.
We recommend the Fortran 2018 statement:
implicit none (type, external)
which requires procedure interfaces to be explicitly defined as well.
type
: the traditionalimplicit none
defaultexternal
: new for Fortran 2018, requires external procedures to have an explicit interface.
Gfortran
Gfortran 8 added -std=f2018
option
to enforce Fortran 2018 standard
support.
Get the latest Gfortran by:
At minimum a modern Fortran program should use these Gfortran options:
gfortran -std=f2018 -Wall -fimplicit-none
Nvidia HPC
The Nvidia HPC Fortran compiler nvfortran
can enforce implicit none
via:
nvfortran -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 -warn
Windows
ifort /stand:f18 /warn
NAG
NAG 7.0 added the Fortran 2018 standard:
nagfor -f2018