Node: What is GNU Fortran?, Next: G77 and GCC, Previous: Getting Started, Up: Top
GNU Fortran, or
g77, is designed initially as a free replacement
for, or alternative to, the UNIX
gcc is designed as a replacement
for the UNIX
g77 also is designed to fit in well with the other
fine GNU compilers and tools.
Sometimes these design goals conflict--in such cases, resolution often is made in favor of fitting in well with Project GNU. These cases are usually identified in the appropriate sections of this manual.
share the following characteristics:
ldcommand. However, the
gcccommands, as with most compiler commands, automatically perform the linking step by calling on
lddirectly, unless asked to not do so by the user.)
How these actions are performed is generally under the control of the user. Using command-line options, the user can specify how persnickety the compiler is to be regarding the program (whether to diagnose questionable usage of the language), how much time to spend making the generated machine code run faster, and so on.
g77 consists of several components:
gcccommand, which also might be installed as the system's
cccommand. (In many cases,
ccrefers to the system's "native" C compiler, which might be a non-GNU compiler, or an older version of
gccconsidered more stable or that is used to build the operating system kernel.)
g77command itself, which also might be installed as the system's
libg2crun-time library. This library contains the machine code needed to support capabilities of the Fortran language that are not directly provided by the machine code generated by the
libg2c is just the unique name
to its version of
libf2c to distinguish it from
any copy of
libf2c installed from
(or versions of
g77 that built
that same name)
on the system.
The maintainer of
libf2c currently is
f771 does not generate machine code directly--it
generates assembly code that is a more readable form
of machine code, leaving the conversion to actual machine code
to an assembler, usually named
gcc is often thought of as "the C compiler" only,
but it does more than that.
Based on command-line options and the names given for files
on the command line,
gcc determines which actions to perform, including
preprocessing, compiling (in a variety of possible languages), assembling,
For example, the command
gcc foo.c drives the file
foo.c through the preprocessor
the C compiler (internally named
cc1), then the assembler (usually
as), then the linker
ld), producing an executable program named
As another example, the command
gcc foo.cc would do much the same as
gcc foo.c, but instead of using the C compiler named
gcc would use the C++ compiler (named
In a GNU Fortran installation,
gcc recognizes Fortran source
files by name just like it does C and C++ source files.
It knows to use the Fortran compiler named
f771, instead of
cc1plus, to compile Fortran files.
Non-Fortran-related operation of
gcc is generally
unaffected by installing the GNU Fortran version of
However, without the installed version of
gcc being the
GNU Fortran version,
gcc will not be able to compile
and link Fortran programs--and since
to do most of the actual work, neither will
g77 command is essentially just a front-end for
Fortran users will normally use
g77 instead of
knows how to specify the libraries needed to link with Fortran programs
g77 can still compile and link programs and
source files written in other languages, just like
g77 -v is a quick
way to display lots of version information for the various programs
used to compile a typical preprocessed Fortran source file--this
produces much more output than
gcc -v currently does.
(If it produces an error message near the end of the output--diagnostics
from the linker, usually
have an out-of-date
libf2c that improperly handles
In the output of this command, the line beginning
GNU Fortran Front
End identifies the version number of GNU Fortran; immediately
preceding that line is a line identifying the version of
with which that version of
g77 was built.
libf2c library is distributed with GNU Fortran for
the convenience of its users, but is not part of GNU Fortran.
It contains the procedures
needed by Fortran programs while they are running.
For example, while code generated by
g77 is likely
to do additions, subtractions, and multiplications in line--in
the actual compiled code--it is not likely to do trigonometric
functions this way.
Instead, operations like trigonometric
functions are compiled by the
g77 when compiling Fortran code) into machine
code that, when run, calls on functions in
libg2c must be linked with almost every useful program
having any component compiled by GNU Fortran.
(As mentioned above, the
g77 command takes
care of all this for you.)
f771 program represents most of what is unique to GNU Fortran.
While much of the
libg2c component comes from
libf2c component of
a free Fortran-to-C converter distributed by Bellcore (AT&T),
libU77, provided by Dave Love,
g77 command is just a small front-end to
f771 is a combination of two rather
large chunks of code.
One chunk is the so-called GNU Back End, or GBE,
which knows how to generate fast code for a wide variety of processors.
The same GBE is used by the C, C++, and Fortran compiler programs
f771, plus others.
Often the GBE is referred to as the "gcc back end" or
even just "gcc"--in this manual, the term GBE is used
whenever the distinction is important.
The other chunk of
f771 is the
majority of what is unique about GNU Fortran--the code that knows how
to interpret Fortran programs to determine what they are intending to
do, and then communicate that knowledge to the GBE for actual compilation
of those programs.
This chunk is called the Fortran Front End (FFE).
cc1plus programs have their own front ends,
for the C and C++ languages, respectively.
These fronts ends are responsible for diagnosing
incorrect usage of their respective languages by the
programs the process, and are responsible for most of
the warnings about questionable constructs as well.
(The GBE handles producing some warnings, like those
concerning possible references to undefined variables.)
Because so much is shared among the compilers for various languages,
much of the behavior and many of the user-selectable options for these
compilers are similar.
For example, diagnostics (error messages and
warnings) are similar in appearance; command-line
-Wall have generally similar effects; and the quality
of generated code (in terms of speed and size) is roughly similar
(since that work is done by the shared GBE).