gfortran — the GNU Fortran compiler, part of GCC
Gfortran is the name of the GNU Fortran project, developing a free Fortran 95/2003 compiler for GCC, the GNU Compiler Collection. The gfortran development effort uses an open development environment in order to attract a larger team of developers and to ensure that gfortran can work on multiple architectures and diverse environments. Please note that gfortran is not g95.
This wiki contains links to binary packages for gfortran, up-to-date status of the compiler, recently fixed bugs, etc. You can find here our "getting started" web page for new users of gfortran.
The official homepage for gfortran also contains a limited amount of general information about the project, its goals and the ways you can contribute.
Quick links
Download
Binaries for Windows, Linux, MacOS and much more!
Vendor-provided packages for common OS distributions
Platforms where gfortran is known to work
Manuals and other documentation
Michael Metcalf's article on Fortran language features in Wikipedia
- GNU Fortran-related mailing lists and news groups
comp.lang.fortran news group (Fortran in general)
Using gfortran:
For gfortran developers
- Bug Bashing (status 30th March 2008; incl. some double counting)
Regressions 1 PRs, 0 assigned (including regressions versus g77)
PRs where a valid program is rejected or wrong code is produced 3 PRs, 2 assigned (Fortran 95 with default options)
PRs where wrong code is produced 15 bugs (2 assigned) [often triggered for special cases only]
PRs where a valid Fortran program is not accepted (internal compiler error, wrongly rejected), wrong code is produced or where the compile time or memory is excessively high 36 bugs (9 assigned)
PRs where invalid code is accepted or gives an internal compiler error 31 bugs (1 assigned)
PRs which show where the diagnostics can be improved 76 bugs (1 assigned)
All reports (bug reports, feature requests etc.): 271 reports (35 assigned)
Graphical bug count timeline (Bugzilla account unfortunately required)
Projects for inclusion into gfortran-4.4: please add your own projects there, with an approximate date of merging and state of readiness
Fortran 2003 implementation status of the GNU Fortran Compiler
Beginner's guide to writing testcases - see also on the main Wiki HowToPrepareATestcase
SymbolVersioning for runtime libraries.
Manuals and other documentation
GFortran documentation is included with the GCC documentation, which is available from the GCC website. There is documentation for released compilers, and also documentation for the latest snapshot from the development tree. The manuals are re-generated nightly.
Documentation for the current development snapshot (PDF); optimization flags (PDF)
Documentation for the 4.3.0 release (PDF); optimization flags (PDF)
Documentation for the 4.2.3 release (PDF); optimization flags (PDF)
Documentation for the 4.1.2 release (PDF); optimization flags (PDF)
Documentation of the GNU Fortran Internals (PDF).
Doxygen documentation of the compiler, points to the full Doxygen documentation, including sources, globals and symbols. This allows you to follow the frontend code in some considerable detail.
GFortranUsage contains helpful info about using gfortran
g77 is probably the most widely used fortran compiler. As of gcc-4.0, it is no longer actively supported
Draft versions of the Fortran standards can be downloaded from the standards committee websites; see GFortranStandards for details.
Floating point accuracy: Semantics of Floating Point Math in GCC, x87 note, Math_Optimization_Flags, Goldberg paper, Monniaux paper
Reporting bugs
You can report bugs in GCC bugzilla. You can look for existing bugs, track bug fixing progress, and report new bugs there. The list of all open gfortran bugs (including enhancement requests and low-priority bugs) can be found here. Before submitting a bug report, please update your version of gfortran to the latest available release of GCC. For example, if you find a bug with gfortran 4.0.2, then upgrade to at least GCC 4.1.0 and see if the bug is still present.
There is a separate page for the most wanted gfortran bugs, which contains a list of bugs that block gfortran from building major packages. Some ideas for enhancing gfortran can also be of interest...
Use the gfortran mailing list, fortran@gcc.gnu.org , to ask the gfortran community your questions, and report bugs if you are uncertain on how to handle bugzilla. We'll be glad to help!
What's new in gfortran?
gfortran 4.1
- Cray pointer support is now implemented.
- gfortran can now build F90gl out of the box.
- The Fortran 2003 ENUMERATION feature is now supported.
Helmut Michels has made a free version of his extensive scientific graphics/GUI package DISLIN available for gfortran.
- Jakub Jelinek updated libgfortran on 2005-11-21 to a thread safe library in preparation for OpenMP.
gfortran 4.2
- GFortran 4.2 and 4.3 use now 4-byte record markers by default for unformatted files to be compatible with g77 and most other compilers. The implementation allows for records bigger than 2 GB, compatible with several other compilers. Older versions of GFortran used by default 8-byte record markers (on most systems); in order to change length of record markers, e.g. to the read unformatted files created by older gfortran versions, the -frecord-marker=8 option can be used.
- Paul Thomas has implemented elemental subroutine support.
- Jakub Jelinek committed the front end support for OpenMP on 2006-02-14.
- Erik Edelmann has implemented allocatable dummy arguments and function results. Allocatable derived type components are on their way.
- Paul Thomas has implemented the array valued TRANSFER intrinsic and an inline version of DOT_PRODUCT.
- Roger Sayle has improved the processing of WHERE statements and blocks.
- Jerry De Lisle added support for the Fortran 2003 streaming IO extension.
- Erik Edelmann and Paul Thomas have implemented Fortran 2003's allocatable components (also known as TR 15581).
- The DEC extensions %VAL, %LOC and %REF are now supported.
gfortran 4.3
Optionally, call a optimized BLAS library (-fexternal-blas) for matrix operations such as matmul rather than the built-in algorithm.
- Added support for VOLATILE, VALUE and PROTECTED statement/attribute.
- Added support for IMPORT and POINTER, INTENT(*).
- The following intrinsic modules are now supported: omp_lib, omp_lib_kinds, ISO_FORTRAN_ENV.
Programs can now optionally dump a core instead of only quitting when an error occurs (such as cannot allocate); this can be set using -fdump-core and overwritten by the run-time variable GFORTRAN_ERROR_DUMPCORE=YES|NO.
- The renaming of operators on the USE statement is now supported.
Support for backtraces on glibc-based systems via the -fbacktrace option is now implemented. On all systems, a coredump can be generated for errors in the run-time library using `-fdump-core`.
GFortran 4.3 now defines __GFORTRAN__ when it runs the C preprocessor (CPP).
- C interoperability support (ISO Bind C) has been added. The code was contributed by Christopher D. Rickett of Los Alamos National Lab.
- Support for ABSTRACT INTERFACEs and the PROCEDURE statement (no procedure pointers yet) has been added by Janus Weil (Google Summer of Code project)
Added support for subreference array pointers; eg. int_ptr_array => derived_array_target(:)%int_component
New options to initialize local variables: -finit-local-zero, -finit-real, -finit-integer, -finit-character, and -finit-logical
The intrinsic functions GAMMA (true gamma function) and LGAMMA (logrithmic gamma function) have been added; use external gamma to continue using a user/external function.
Changed: -fno-backslash is now the default to be more compatible with Fortran 2003; use -fbackslash if you need C character escape sequences.
BOZ: Fortran 2003 BOZ are now supported, i.e. using BOZ as argument of INT(), REAL(), DBLE() and CMPLX(). Additionally, BOZ used in DATA statements to initialize non-integer variables and BOZ directly assigned to a real/complex are now transferred bitwise. See the GNU Fortran manual for details.
- Versioned symbols are used now on platforms supporting them. Programs compiled with gfortran 4.3 are guaranteed to work with the libgfortran library of future gfortran releases.
gfortran 4.4 (the current development version)
- Support for a few Fortran 2008 intrinsics: ASINH, ACOSH, ATANH, ERF, ERFC, GAMMA, LOG_GAMMA, BESSEL_*, HYPOT and ERFC_SCALED (some of these were available as vendor extension before)
- Fortran 2003 I/O extensions: Asynchronous I/O is supported (still implemented as synchronous I/O), decimal=, size=, sign=, pad= blank=, delim=, encoding=, and round= specifiers. (Only encoding="default" is supported and round= is available only in INQUIRE where it returns PROCESSOR_DEFINED.)
- SELECTED_CHAR_KIND (only "DEFAULT" and "ASCII" are supported; "ISO_10646" (UCS-4) is planed but not required by the Fortran 2003 standard)