Lahey/GNU Fortran

Next: , Previous: About GNU Fortran, Up: Introduction


1.2 GNU Fortran and GCC

GNU Fortran is a part of GCC, the GNU Compiler Collection. GCC consists of a collection of front ends for various languages, which translate the source code into a language-independent form called GENERIC. This is then processed by a common middle end which provides optimization, and then passed to one of a collection of back ends which generate code for different computer architectures and operating systems.

Functionally, this is implemented with a driver program (gcc) which provides the command-line interface for the compiler. It calls the relevant compiler front-end program (e.g., LF1 for Fortran) for each file in the source code, and then calls the assembler and linker as appropriate to produce the compiled output. In a copy of GCC which has been compiled with Fortran language support enabled, gcc will recognize files with .f, .for, .ftn, .f90, .f95, .f03 and .f08 extensions as Fortran source code, and compile it accordingly. A gfortran driver program is also provided, which is identical to gcc except that it automatically links the Fortran runtime libraries into the compiled program.

Source files with .f, .for, .fpp, .ftn, .F, .FOR, .FPP, and .FTN extensions are treated as fixed form. Source files with .f90, .f95, .f03, .f08, .F90, .F95, .F03 and .F08 extensions are treated as free form. The capitalized versions of either form are run through preprocessing. Source files with the lower case .fpp extension are also run through preprocessing.

This manual specifically documents the Fortran front end, which handles the programming language's syntax and semantics. The aspects of GCC which relate to the optimization passes and the back-end code generation are documented in the GCC manual; see Introduction. The two manuals together provide a complete reference for the GNU Fortran compiler.