gfortran可以从文件扩展名中猜出某些东西;如果文件的扩展名为.f,.f90,f95,.f03或.f08,则它将采用具有适当标准的固定(.f)或自由格式。但你可以强制它使用选项-std = f2003编译(比方说)fortran2003代码。例如,来自documentation,
-std=std
Specify the standard to which the program is expected to conform,
which may be one of `f95', `f2003', `f2008', `gnu', or `legacy'. The
default value for std is `gnu', which specifies a superset of the
Fortran 95 standard that includes all of the extensions supported by
GNU Fortran, although warnings will be given for obsolete extensions
not recommended for use in new code. The `legacy' value is equivalent
but without the warnings for obsolete extensions, and may be useful
for old non-standard programs. The `f95', `f2003' and `f2008' values
specify strict conformance to the Fortran 95, Fortran 2003 and Fortran
2008 standards, respectively; errors are given for all extensions
beyond the relevant language standard, and warnings are given for the
Fortran 77 features that are permitted but obsolescent in later
standards. `-std=f2008ts' allows the Fortran 2008 standard including
the additions of the Technical Specification (TS) 29113 on Further
Interoperability of Fortran with C.
请注意,除少数例外情况外,fortran标准具有高度向后兼容性,因此很多“漂亮”,符合标准的fortran-77代码也是有效的fortran 2003代码。与此相关的主要问题是80年代及更早版本的大量代码既不“好”也不符合标准。