g77 - GNU project Fortran Compiler (v0.5.21)


g77 [option|filename] ...


If you find a discrepancy between information in this man page and the software, please check the Info file, which is the authoritative documentation. (Note: The Info file is not available in Microsoft Windows Services for UNIX.)

If we find that the things in this man page that are out of date cause significant confusion or complaints, we will stop distributing the man page. The alternative, updating the man page when we update the Info file, is impractical because the rest of the work of maintaining GNU Fortran leaves us no time for that. The GNU project regards man pages as obsolete and should not let them take time away from other things.

For complete and current documentation, refer to the Info file g77(1) or the manual Using and Porting GNU Fortran (for version 0.5.21). Both are made from the Texinfo source file g77.texi. The Info file is available from the Interix Web site(http://www.microsoft.com/), in both Info and Portable Document Format (PDF) file formats.

If your system has the info(1) command installed, the command

info g77
should work, unless g77(1) has not been properly installed. (Note: The info(1) command is not available in Windows Services for UNIX.)


The C and F77 compilers are integrated; g77(1) is a program to call gcc(1) with options to recognize programs written in Fortran (ANSI FORTRAN 77, also called F77). The gcc(1) utility processes input files through one or more of four stages: preprocessing, compilation, assembly, and linking. This topic contains full descriptions for only F77-specific aspects of the compiler, though it also contains summaries of some general-purpose options. For an explanation of the compiler, see gcc(1).

For complete documentation on GNU Fortran, see the Info file.

F77 source files use the suffix .f or .for. F77 files to be preprocessed by cpp(1) use the suffix .F or .fpp. Ratfor source files use the suffix .r (although ratfor itself is not supplied as part of g77(1)).


Many command-line options, including options to control details of optimization, warnings, and code generation, are common to both gcc(1) and g77(1). For full information on all options, see gcc(1).

Options must be separate: -dr is quite different from -d -r.

Most -f and -W options have two contrary forms: -fname and -fno-name (or -Wname and -Wno-name). Only the non-default forms are shown here.

Compile or assemble the source files, but do not link. The compiler output is an object file corresponding to each source file.
Define macro with the string 1 as its definition.
Define macro as defn.
Specifies that command, rather than gcc(1), is to be invoked by g77(1) to do its job. Example: Within the gcc build directory, after building GNU Fortran (but without having to install it):
./g77 --driver=./xgcc -B./ foo.f
Stop after the preprocessing stage; do not run the compiler proper. The output is preprocessed source code, which is sent to the standard output.
Produce debugging information in the operating system's native format (for DBX or SDB or DWARF). The gdb utility can also work with this debugging information. On most systems that use DBX format, -g enables use of extra debugging information that only gdb can use.

Unlike most other Fortran compilers, with GNU Fortran you can use -g with -O. The shortcuts taken by optimized code may occasionally produce surprising results: some variables you declared may not exist at all; flow of control may briefly move where you did not expect it; some statements may not be executed because they compute constant results or their values were already at hand; and some statements may execute in different places because they were moved out of loops.

Nevertheless, it proves possible to debug optimized output. This makes it reasonable to use the optimizer for programs that might have bugs.

Append directory dir to the list of directories searched for include files.
Add directory dir to the list of directories to be searched for -l.
Use the library named library when linking.
Do not search the standard system directories for header files. Only the directories you have specified with -I options (and the current directory, if appropriate) are searched.
Optimize. Optimizing compilation takes somewhat more time, and considerably more memory for a large function. See the gcc documentation for further optimization options. Loop unrolling, in particular, may be worth investigating for typical numerical Fortran programs.
Place output in file file.
Stop after the stage of compilation proper; do not assemble. The output is an assembler code file for each non-assembler input file specified.
Undefine macro.
Print (on standard error output) the commands executed to run the stages of compilation. Also print the version number of the compiler driver program and of the preprocessor and the compiler proper. The version numbers of g77 itself and the gcc distribution on which it is based are distinct. Use --driver=true to disable actual invocation of gcc(1) (since true(1) is the name of a command that simply returns success status). The following command is the appropriate one to determine the g77 and gcc version numbers:
g77 -v
Issue warnings for conditions which pertain to usage that we recommend avoiding, and that we believe is easy to avoid, even in conjunction with macros.


C header (preprocessor) file
Fortran source file
Fortran source file
Preprocessed Fortran source file
Preprocessed Fortran source file
Ratfor source file (ratfor not included)
Assembly language file
Object file
Link edited output
temporary files
Fortran run-time library
gcc subroutine library
Start-up routine
Standard C library, see intro(3)
Standard directory for #include files
Standard gcc directory for #include files.

LIBDIR is usually /usr/lib/machine/version.

TMPDIR comes from the environment variable TMPDIR (default /tmp if available, otherwise /tmp).







See the g77, gcc, as, ld, and gdb entries in info(1). (The info(1) command is not distributed with Interix.)

Note that adb(1), dbx(1), and sdb(1) are not currently available on Interix systems.

Using and Porting GNU Fortran (for version 0.5.21) James Craig Burley; Using and Porting GNU CC (for version 2.0) Richard M. Stallman; The C Preprocessor Richard M. Stallman; Debugging with GDB: the GNU Source-Level Debugger Richard M. Stallman and Roland H. Pesch; Using as: the GNU Assembler Dean Elsner, Jay Fenlason & friends; gld: the GNU linker Steve Chamberlain and Roland Pesch.


Copyright (c) 1991-1997 Free Software Foundation, Inc.

Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.

Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.

Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that this permission notice may be included in translations approved by the Free Software Foundation instead of in the original English.


See the GNU CC Manual for the contributors to GNU CC. See the GNU Fortran Manual for the contributors to GNU Fortran.