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 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 an intermediate code generator. The code generator translates the semantics of the source code into a language independent form 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. The optimized AST is then handed off too the back end which assembles 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. Specifically, 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.