GCC Fortran

I have a low-priority question about the GCC Fortran package (gcc48-fortran 4.8.5-38.4).

According to https://gcc.gnu.org/fortran/ “The initial goal of the GNU Fortran Project was construction of a Fortran 95 compiler that complies with the ISO Fortran 95 Programming Language standard [ISO/IEC 1539-1:1997(E)]. We are now well into F2003 and F2008 features.”

However the package included with Leap 42.3 doesn’t appear to support the command-line option
-std = { f95 | f2003 | f2008 | gnu | legacy } as documented in the package man page. The single option “f95” with no “-std=” is accepted, but none of the alternatives.

What Fortran version is actually supported by this package? Has the man page got ahead of the implementation?

David L.

I should have mentioned that the comments above apply to gcc8-fortran too.

Am I correct in thinking that the Leap-42.3 packages gcc48-fortran and gcc5- gcc6- gcc7- gcc8-fortran reflect the Gnu Compiler Collection versions 4.8, 5, 6, 7, 8?


erlangen:~ # gfortran-8 --version
GNU Fortran (SUSE Linux) 8.3.1 20190226 [gcc-8-branch revision 269204]
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO

erlangen:~ # gfortran-8 -std=f2008
gfortran-8: fatal error: no input files
compilation terminated.
erlangen:~ # 

Yes, that’s reasonable.

  • Please note that, the GCC 4.8 collection is available only for openSUSE Leap 42.3 – with Leap 15.0, GCC 4.8 support has been dropped – but, I can’t find any reference to this in the Release Notes …

Please note that, the GCC Fortran man page in gfortran-8.1.gz retrieved from the Leap 15.0 repository contains the following:

-std=stdSpecify the standard to which the program is expected to conform, which may be one of f95, f2003, f2008, f2018, gnu, or legacy. The default value for std is gnu, which specifies a superset of the latest Fortran 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, f2008, and f2018 values specify strict conformance to the Fortran 95, Fortran 2003, Fortran 2008 and Fortran 2018 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 and TS 18508 on Additional Parallel Features in Fortran.

I have absolutely no idea if, the equivalent man page for the GCC 8 Fortran in the Leap 42.3 repository also contains this information, or not …

Yes that’s what I see too, but I think GCC checks for a source file before it validates the command options and gives up immediately if there’s none.

It does.

Thanks for your responses. The -std option isn’t a big issue for me, and it’s probably the case that the package supports a good part of Fortran-2008. But I think it would be helpful if GCC included some statement about the standards-status of each language. And the man-page options should certainly work!


The GCC folks do indeed supply this information: <https://gcc.gnu.org/wiki/GFortranStandards&gt; and <https://gcc.gnu.org/wiki/GFortran&gt;.

Tried -std=legacy on real legacy code: http://bitsavers.informatik.uni-stuttgart.de/pdf/calcomp/CalComp_Software_Reference_Manual_Oct76.pdf

erlangen:~ # gfortran-8 -std=legacy /mnt/KWUPLOT.FOR

       CHARACTER*10 date@
Error: Syntax error in data declaration at (1)

       ZDATE = date@()
Error: Unclassifiable statement at (1)

Error: Non-numeric character in statement label at (1)
erlangen:~ # 

It complains about @, but otherwise processes all of the code.

You had me doubting my sanity for a while!

I was using a ‘-x’ option on the command line, however I now see there’s no such option documented in the gfortran-8 man page and it must have been carried over from a previous version. This led to the following confusing results:

david@anon:~> gfortran-8 -x f95   -ffree-form -o helloWorld helloWorld.f95
david@anon:~> gfortran-8 -x f2003 -ffree-form -o helloWorld helloWorld.f95
gfortran-8: error: language f2003 not recognized
gfortran-8: error: language f2003 not recognized
david@anon:~> gfortran-8 -x -std=f2003 -ffree-form -o helloWorld helloWorld.f95
gfortran-8: error: language -std=f2003 not recognized
gfortran-8: error: language -std=f2003 not recognized
david@anon:~> gfortran-8 -std=f2003 -ffree-form -o helloWorld helloWorld.f95

I assume ‘-x f95’ instructed a previous version of the compiler to use the Fortran-95 standard and it’s been retained in gfortran-8 for backwards compatibility but not documented, however that functionality has been changed to ‘-std=’ now.

I apologise for the wild-goose chase…