Next: , Previous: Getting Started, Up: Top


GCC used to be the GNU “C” Compiler, but is now known as the GNU Compiler Collection. GCC provides the GNU system with a very versatile compiler middle end (shared optimization passes), and with back ends (code generators) for many different computer architectures and operating systems. The code of the middle end and back end are shared by all compiler front ends that are in the GNU Compiler Collection.

A GCC front end is essentially a source code parser and a pass to generate a representation of the semantics of the program in the source code in the GCC language independent intermediate language, called GENERIC.

The parser takes a source file written in a particular computer language, reads and parses it, and tries to make sure that the source code conforms to the language rules. Once the correctness of a program has been established, the compiler will build a data structure known as the Abstract Syntax tree, or just AST or “tree” for short. This data structure represents the whole program or a subroutine or a function. The “tree” is passed to the GCC middle end, which will perform optimization passes on it, pass the optimized AST and generate assembly for the program unit.

Different phases in this translation process can be, and in fact are merged in many compiler front ends. GNU Fortran 95 has a strict separation between the parser and code generator.

The goal of the gfortran project is to build a new front end for GCC: A Fortran 95 front end. In a non-gfortran installation, gcc will not be able to compile Fortran 95 source code (only the “C” front end has to be compiled if you want to build GCC, all other languages are optional). If you build GCC with gfortran, gcc will recognize .f/.f90/.f95 source files and accepts Fortran 95 specific command line options.