This is g77.info, produced by makeinfo version 4.5 from g77.texi. INFO-DIR-SECTION Programming START-INFO-DIR-ENTRY * g77: (g77). The GNU Fortran compiler. END-INFO-DIR-ENTRY This file documents the use and the internals of the GNU Fortran (`g77') compiler. It corresponds to the GCC-3.2.3 version of `g77'. Published by the Free Software Foundation 59 Temple Place - Suite 330 Boston, MA 02111-1307 USA Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Free Software Foundation, Inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with the Invariant Sections being "GNU General Public License" and "Funding Free Software", the Front-Cover texts being (a) (see below), and with the Back-Cover Texts being (b) (see below). A copy of the license is included in the section entitled "GNU Free Documentation License". (a) The FSF's Front-Cover Text is: A GNU Manual (b) The FSF's Back-Cover Text is: You have freedom to copy and modify this GNU Manual, like GNU software. Copies published by the Free Software Foundation raise funds for GNU development. Contributed by James Craig Burley (). Inspired by a first pass at translating `g77-0.5.16/f/DOC' that was contributed to Craig by David Ronis ().  File: g77.info, Node: Getting Started, Next: What is GNU Fortran?, Prev: Funding GNU Fortran, Up: Top Getting Started *************** If you don't need help getting started reading the portions of this manual that are most important to you, you should skip this portion of the manual. If you are new to compilers, especially Fortran compilers, or new to how compilers are structured under UNIX and UNIX-like systems, you'll want to see *Note What is GNU Fortran?::. If you are new to GNU compilers, or have used only one GNU compiler in the past and not had to delve into how it lets you manage various versions and configurations of `gcc', you should see *Note G77 and GCC::. Everyone except experienced `g77' users should see *Note Invoking G77::. If you're acquainted with previous versions of `g77', you should see *Note News About GNU Fortran: News. Further, if you've actually used previous versions of `g77', especially if you've written or modified Fortran code to be compiled by previous versions of `g77', you should see *Note Changes::. If you intend to write or otherwise compile code that is not already strictly conforming ANSI FORTRAN 77--and this is probably everyone--you should see *Note Language::. If you run into trouble getting Fortran code to compile, link, run, or work properly, you might find answers if you see *Note Debugging and Interfacing::, see *Note Collected Fortran Wisdom::, and see *Note Trouble::. You might also find that the problems you are encountering are bugs in `g77'--see *Note Bugs::, for information on reporting them, after reading the other material. If you need further help with `g77', or with freely redistributable software in general, see *Note Service::. If you would like to help the `g77' project, see *Note Funding GNU Fortran::, for information on helping financially, and see *Note Projects::, for information on helping in other ways. If you're generally curious about the future of `g77', see *Note Projects::. If you're curious about its past, see *Note Contributors::, and see *Note Funding GNU Fortran::. To see a few of the questions maintainers of `g77' have, and that you might be able to answer, see *Note Open Questions::.  File: g77.info, Node: What is GNU Fortran?, Next: G77 and GCC, Prev: Getting Started, Up: Top What is GNU Fortran? ******************** GNU Fortran, or `g77', is designed initially as a free replacement for, or alternative to, the UNIX `f77' command. (Similarly, `gcc' is designed as a replacement for the UNIX `cc' command.) `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. As compilers, `g77', `gcc', and `f77' share the following characteristics: * They read a user's program, stored in a file and containing instructions written in the appropriate language (Fortran, C, and so on). This file contains "source code". * They translate the user's program into instructions a computer can carry out more quickly than it takes to translate the instructions in the first place. These instructions are called "machine code"--code designed to be efficiently translated and processed by a machine such as a computer. Humans usually aren't as good writing machine code as they are at writing Fortran or C, because it is easy to make tiny mistakes writing machine code. When writing Fortran or C, it is easy to make big mistakes. * They provide information in the generated machine code that can make it easier to find bugs in the program (using a debugging tool, called a "debugger", such as `gdb'). * They locate and gather machine code already generated to perform actions requested by statements in the user's program. This machine code is organized into "libraries" and is located and gathered during the "link" phase of the compilation process. (Linking often is thought of as a separate step, because it can be directly invoked via the `ld' command. However, the `g77' and `gcc' commands, as with most compiler commands, automatically perform the linking step by calling on `ld' directly, unless asked to not do so by the user.) * They attempt to diagnose cases where the user's program contains incorrect usages of the language. The "diagnostics" produced by the compiler indicate the problem and the location in the user's source file where the problem was first noticed. The user can use this information to locate and fix the problem. (Sometimes an incorrect usage of the language leads to a situation where the compiler can no longer make any sense of what follows--while a human might be able to--and thus ends up complaining about many "problems" it encounters that, in fact, stem from just one problem, usually the first one reported.) * They attempt to diagnose cases where the user's program contains a correct usage of the language, but instructs the computer to do something questionable. These diagnostics often are in the form of "warnings", instead of the "errors" that indicate incorrect usage of the language. 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: * A modified version of the `gcc' command, which also might be installed as the system's `cc' command. (In many cases, `cc' refers to the system's "native" C compiler, which might be a non-GNU compiler, or an older version of `gcc' considered more stable or that is used to build the operating system kernel.) * The `g77' command itself, which also might be installed as the system's `f77' command. * The `libg2c' run-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 `g77' compilation phase. `libg2c' is just the unique name `g77' gives to its version of `libf2c' to distinguish it from any copy of `libf2c' installed from `f2c' (or versions of `g77' that built `libf2c' under that same name) on the system. The maintainer of `libf2c' currently is . * The compiler itself, internally named `f771'. Note that `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 `as'. `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, and linking. For example, the command `gcc foo.c' "drives" the file `foo.c' through the preprocessor `cpp', then the C compiler (internally named `cc1'), then the assembler (usually `as'), then the linker (`ld'), producing an executable program named `a.out' (on UNIX systems). 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 `cc1', `gcc' would use the C++ compiler (named `cc1plus'). 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 `cc1' or `cc1plus', to compile Fortran files. Non-Fortran-related operation of `gcc' is generally unaffected by installing the GNU Fortran version of `gcc'. 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 `g77' uses `gcc' to do most of the actual work, neither will `g77'! The `g77' command is essentially just a front-end for the `gcc' command. Fortran users will normally use `g77' instead of `gcc', because `g77' knows how to specify the libraries needed to link with Fortran programs (`libg2c' and `lm'). `g77' can still compile and link programs and source files written in other languages, just like `gcc'. The command `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 `ld'--you might have an out-of-date `libf2c' that improperly handles complex arithmetic.) 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 `gcc' with which that version of `g77' was built. The `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 `f771' compiler (invoked by `g77' when compiling Fortran code) into machine code that, when run, calls on functions in `libg2c', so `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.) The `f771' program represents most of what is unique to GNU Fortran. While much of the `libg2c' component comes from the `libf2c' component of `f2c', a free Fortran-to-C converter distributed by Bellcore (AT&T), plus `libU77', provided by Dave Love, and the `g77' command is just a small front-end to `gcc', `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 `cc1', `cc1plus', and `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). The `cc1' and `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 options like `-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).  File: g77.info, Node: G77 and GCC, Next: Invoking G77, Prev: What is GNU Fortran?, Up: Top Compile Fortran, C, or Other Programs ************************************* A GNU Fortran installation includes a modified version of the `gcc' command. In a non-Fortran installation, `gcc' recognizes C, C++, and Objective-C source files. In a GNU Fortran installation, `gcc' also recognizes Fortran source files and accepts Fortran-specific command-line options, plus some command-line options that are designed to cater to Fortran users but apply to other languages as well. *Note Compile C; C++; Objective-C; Ada; Fortran; or Java: (gcc)G++ and GCC, for information on the way different languages are handled by the GNU CC compiler (`gcc'). Also provided as part of GNU Fortran is the `g77' command. The `g77' command is designed to make compiling and linking Fortran programs somewhat easier than when using the `gcc' command for these tasks. It does this by analyzing the command line somewhat and changing it appropriately before submitting it to the `gcc' command. Use the `-v' option with `g77' to see what is going on--the first line of output is the invocation of the `gcc' command.  File: g77.info, Node: Invoking G77, Next: News, Prev: G77 and GCC, Up: Top GNU Fortran Command Options *************************** The `g77' command supports all the options supported by the `gcc' command. *Note GCC Command Options: (gcc)Invoking GCC, for information on the non-Fortran-specific aspects of the `gcc' command (and, therefore, the `g77' command). All `gcc' and `g77' options are accepted both by `g77' and by `gcc' (as well as any other drivers built at the same time, such as `g++'), since adding `g77' to the `gcc' distribution enables acceptance of `g77' options by all of the relevant drivers. In some cases, options have positive and negative forms; the negative form of `-ffoo' would be `-fno-foo'. This manual documents only one of these two forms, whichever one is not the default. * Menu: * Option Summary:: Brief list of all `g77' options, without explanations. * Overall Options:: Controlling the kind of output: an executable, object files, assembler files, or preprocessed source. * Shorthand Options:: Options that are shorthand for other options. * Fortran Dialect Options:: Controlling the variant of Fortran language compiled. * Warning Options:: How picky should the compiler be? * Debugging Options:: Symbol tables, measurements, and debugging dumps. * Optimize Options:: How much optimization? * Preprocessor Options:: Controlling header files and macro definitions. Also, getting dependency information for Make. * Directory Options:: Where to find header files and libraries. Where to find the compiler executable files. * Code Gen Options:: Specifying conventions for function calls, data layout and register usage. * Environment Variables:: Env vars that affect GNU Fortran.  File: g77.info, Node: Option Summary, Next: Overall Options, Up: Invoking G77 Option Summary ============== Here is a summary of all the options specific to GNU Fortran, grouped by type. Explanations are in the following sections. _Overall Options_ *Note Options Controlling the Kind of Output: Overall Options. -fversion -fset-g77-defaults -fno-silent _Shorthand Options_ *Note Shorthand Options::. -ff66 -fno-f66 -ff77 -fno-f77 -fno-ugly _Fortran Language Options_ *Note Options Controlling Fortran Dialect: Fortran Dialect Options. -ffree-form -fno-fixed-form -ff90 -fvxt -fdollar-ok -fno-backslash -fno-ugly-args -fno-ugly-assign -fno-ugly-assumed -fugly-comma -fugly-complex -fugly-init -fugly-logint -fonetrip -ftypeless-boz -fintrin-case-initcap -fintrin-case-upper -fintrin-case-lower -fintrin-case-any -fmatch-case-initcap -fmatch-case-upper -fmatch-case-lower -fmatch-case-any -fsource-case-upper -fsource-case-lower -fsource-case-preserve -fsymbol-case-initcap -fsymbol-case-upper -fsymbol-case-lower -fsymbol-case-any -fcase-strict-upper -fcase-strict-lower -fcase-initcap -fcase-upper -fcase-lower -fcase-preserve -ff2c-intrinsics-delete -ff2c-intrinsics-hide -ff2c-intrinsics-disable -ff2c-intrinsics-enable -fbadu77-intrinsics-delete -fbadu77-intrinsics-hide -fbadu77-intrinsics-disable -fbadu77-intrinsics-enable -ff90-intrinsics-delete -ff90-intrinsics-hide -ff90-intrinsics-disable -ff90-intrinsics-enable -fgnu-intrinsics-delete -fgnu-intrinsics-hide -fgnu-intrinsics-disable -fgnu-intrinsics-enable -fmil-intrinsics-delete -fmil-intrinsics-hide -fmil-intrinsics-disable -fmil-intrinsics-enable -funix-intrinsics-delete -funix-intrinsics-hide -funix-intrinsics-disable -funix-intrinsics-enable -fvxt-intrinsics-delete -fvxt-intrinsics-hide -fvxt-intrinsics-disable -fvxt-intrinsics-enable -ffixed-line-length-N -ffixed-line-length-none _Warning Options_ *Note Options to Request or Suppress Warnings: Warning Options. -fsyntax-only -pedantic -pedantic-errors -fpedantic -w -Wno-globals -Wimplicit -Wunused -Wuninitialized -Wall -Wsurprising -Werror -W _Debugging Options_ *Note Options for Debugging Your Program or GCC: Debugging Options. -g _Optimization Options_ *Note Options that Control Optimization: Optimize Options. -malign-double -ffloat-store -fforce-mem -fforce-addr -fno-inline -ffast-math -fstrength-reduce -frerun-cse-after-loop -funsafe-math-optimizations -fno-trapping-math -fexpensive-optimizations -fdelayed-branch -fschedule-insns -fschedule-insn2 -fcaller-saves -funroll-loops -funroll-all-loops -fno-move-all-movables -fno-reduce-all-givs -fno-rerun-loop-opt _Directory Options_ *Note Options for Directory Search: Directory Options. -IDIR -I- _Code Generation Options_ *Note Options for Code Generation Conventions: Code Gen Options. -fno-automatic -finit-local-zero -fno-f2c -ff2c-library -fno-underscoring -fno-ident -fpcc-struct-return -freg-struct-return -fshort-double -fno-common -fpack-struct -fzeros -fno-second-underscore -femulate-complex -falias-check -fargument-alias -fargument-noalias -fno-argument-noalias-global -fno-globals -fflatten-arrays -fbounds-check -ffortran-bounds-check * Menu: * Overall Options:: Controlling the kind of output: an executable, object files, assembler files, or preprocessed source. * Shorthand Options:: Options that are shorthand for other options. * Fortran Dialect Options:: Controlling the variant of Fortran language compiled. * Warning Options:: How picky should the compiler be? * Debugging Options:: Symbol tables, measurements, and debugging dumps. * Optimize Options:: How much optimization? * Preprocessor Options:: Controlling header files and macro definitions. Also, getting dependency information for Make. * Directory Options:: Where to find header files and libraries. Where to find the compiler executable files. * Code Gen Options:: Specifying conventions for function calls, data layout and register usage.  File: g77.info, Node: Overall Options, Next: Shorthand Options, Prev: Option Summary, Up: Invoking G77 Options Controlling the Kind of Output ====================================== Compilation can involve as many as four stages: preprocessing, code generation (often what is really meant by the term "compilation"), assembly, and linking, always in that order. The first three stages apply to an individual source file, and end by producing an object file; linking combines all the object files (those newly compiled, and those specified as input) into an executable file. For any given input file, the file name suffix determines what kind of program is contained in the file--that is, the language in which the program is written is generally indicated by the suffix. Suffixes specific to GNU Fortran are listed below. *Note Options Controlling the Kind of Output: (gcc)Overall Options, for information on suffixes recognized by GNU CC. `FILE.f' `FILE.for' `FILE.FOR' Fortran source code that should not be preprocessed. Such source code cannot contain any preprocessor directives, such as `#include', `#define', `#if', and so on. You can force `.f' files to be preprocessed by `cpp' by using `-x f77-cpp-input'. *Note LEX::. `FILE.F' `FILE.fpp' `FILE.FPP' Fortran source code that must be preprocessed (by the C preprocessor `cpp', which is part of GNU CC). Note that preprocessing is not extended to the contents of files included by the `INCLUDE' directive--the `#include' preprocessor directive must be used instead. `FILE.r' Ratfor source code, which must be preprocessed by the `ratfor' command, which is available separately (as it is not yet part of the GNU Fortran distribution). One version in Fortran, adapted for use with `g77' is at `ftp://members.aol.com/n8tm/rat7.uue' (of uncertain copyright status). Another, public domain version in C is at `http://sepwww.stanford.edu/sep/prof/ratfor.shar.2'. UNIX users typically use the `FILE.f' and `FILE.F' nomenclature. Users of other operating systems, especially those that cannot distinguish upper-case letters from lower-case letters in their file names, typically use the `FILE.for' and `FILE.fpp' nomenclature. Use of the preprocessor `cpp' allows use of C-like constructs such as `#define' and `#include', but can lead to unexpected, even mistaken, results due to Fortran's source file format. It is recommended that use of the C preprocessor be limited to `#include' and, in conjunction with `#define', only `#if' and related directives, thus avoiding in-line macro expansion entirely. This recommendation applies especially when using the traditional fixed source form. With free source form, fewer unexpected transformations are likely to happen, but use of constructs such as Hollerith and character constants can nevertheless present problems, especially when these are continued across multiple source lines. These problems result, primarily, from differences between the way such constants are interpreted by the C preprocessor and by a Fortran compiler. Another example of a problem that results from using the C preprocessor is that a Fortran comment line that happens to contain any characters "interesting" to the C preprocessor, such as a backslash at the end of the line, is not recognized by the preprocessor as a comment line, so instead of being passed through "raw", the line is edited according to the rules for the preprocessor. For example, the backslash at the end of the line is removed, along with the subsequent newline, resulting in the next line being effectively commented out--unfortunate if that line is a non-comment line of important code! _Note:_ The `-traditional' and `-undef' flags are supplied to `cpp' by default, to help avoid unpleasant surprises. *Note Options Controlling the Preprocessor: (gcc)Preprocessor Options. This means that ANSI C preprocessor features (such as the `#' operator) aren't available, and only variables in the C reserved namespace (generally, names with a leading underscore) are liable to substitution by C predefines. Thus, if you want to do system-specific tests, use, for example, `#ifdef __linux__' rather than `#ifdef linux'. Use the `-v' option to see exactly how the preprocessor is invoked. Unfortunately, the `-traditional' flag will not avoid an error from anything that `cpp' sees as an unterminated C comment, such as: C Some Fortran compilers accept /* as starting C an inline comment. *Note Trailing Comment::. The following options that affect overall processing are recognized by the `g77' and `gcc' commands in a GNU Fortran installation: `-fversion' Ensure that the `g77' version of the compiler phase is reported, if run, and, starting in `egcs' version 1.1, that internal consistency checks in the `f771' program are run. This option is supplied automatically when `-v' or `--verbose' is specified as a command-line option for `g77' or `gcc' and when the resulting commands compile Fortran source files. In GCC 3.1, this is changed back to the behaviour `gcc' displays for `.c' files. `-fset-g77-defaults' _Version info:_ This option was obsolete as of `egcs' version 1.1. The effect is instead achieved by the `lang_init_options' routine in `gcc/gcc/f/com.c'. Set up whatever `gcc' options are to apply to Fortran compilations, and avoid running internal consistency checks that might take some time. This option is supplied automatically when compiling Fortran code via the `g77' or `gcc' command. The description of this option is provided so that users seeing it in the output of, say, `g77 -v' understand why it is there. Also, developers who run `f771' directly might want to specify it by hand to get the same defaults as they would running `f771' via `g77' or `gcc' However, such developers should, after linking a new `f771' executable, invoke it without this option once, e.g. via `./f771 -quiet < /dev/null', to ensure that they have not introduced any internal inconsistencies (such as in the table of intrinsics) before proceeding--`g77' will crash with a diagnostic if it detects an inconsistency. `-fno-silent' Print (to `stderr') the names of the program units as they are compiled, in a form similar to that used by popular UNIX `f77' implementations and `f2c' *Note Options Controlling the Kind of Output: (gcc)Overall Options, for information on more options that control the overall operation of the `gcc' command (and, by extension, the `g77' command).  File: g77.info, Node: Shorthand Options, Next: Fortran Dialect Options, Prev: Overall Options, Up: Invoking G77 Shorthand Options ================= The following options serve as "shorthand" for other options accepted by the compiler: `-fugly' _Note:_ This option is no longer supported. The information, below, is provided to aid in the conversion of old scripts. Specify that certain "ugly" constructs are to be quietly accepted. Same as: -fugly-args -fugly-assign -fugly-assumed -fugly-comma -fugly-complex -fugly-init -fugly-logint These constructs are considered inappropriate to use in new or well-maintained portable Fortran code, but widely used in old code. *Note Distensions::, for more information. `-fno-ugly' Specify that all "ugly" constructs are to be noisily rejected. Same as: -fno-ugly-args -fno-ugly-assign -fno-ugly-assumed -fno-ugly-comma -fno-ugly-complex -fno-ugly-init -fno-ugly-logint *Note Distensions::, for more information. `-ff66' Specify that the program is written in idiomatic FORTRAN 66. Same as `-fonetrip -fugly-assumed'. The `-fno-f66' option is the inverse of `-ff66'. As such, it is the same as `-fno-onetrip -fno-ugly-assumed'. The meaning of this option is likely to be refined as future versions of `g77' provide more compatibility with other existing and obsolete Fortran implementations. `-ff77' Specify that the program is written in idiomatic UNIX FORTRAN 77 and/or the dialect accepted by the `f2c' product. Same as `-fbackslash -fno-typeless-boz'. The meaning of this option is likely to be refined as future versions of `g77' provide more compatibility with other existing and obsolete Fortran implementations. `-fno-f77' The `-fno-f77' option is _not_ the inverse of `-ff77'. It specifies that the program is not written in idiomatic UNIX FORTRAN 77 or `f2c' but in a more widely portable dialect. `-fno-f77' is the same as `-fno-backslash'. The meaning of this option is likely to be refined as future versions of `g77' provide more compatibility with other existing and obsolete Fortran implementations.  File: g77.info, Node: Fortran Dialect Options, Next: Warning Options, Prev: Shorthand Options, Up: Invoking G77 Options Controlling Fortran Dialect =================================== The following options control the dialect of Fortran that the compiler accepts: `-ffree-form' `-fno-fixed-form' Specify that the source file is written in free form (introduced in Fortran 90) instead of the more-traditional fixed form. `-ff90' Allow certain Fortran-90 constructs. This option controls whether certain Fortran 90 constructs are recognized. (Other Fortran 90 constructs might or might not be recognized depending on other options such as `-fvxt', `-ff90-intrinsics-enable', and the current level of support for Fortran 90.) *Note Fortran 90::, for more information. `-fvxt' Specify the treatment of certain constructs that have different meanings depending on whether the code is written in GNU Fortran (based on FORTRAN 77 and akin to Fortran 90) or VXT Fortran (more like VAX FORTRAN). The default is `-fno-vxt'. `-fvxt' specifies that the VXT Fortran interpretations for those constructs are to be chosen. *Note VXT Fortran::, for more information. `-fdollar-ok' Allow `$' as a valid character in a symbol name. `-fno-backslash' Specify that `\' is not to be specially interpreted in character and Hollerith constants a la C and many UNIX Fortran compilers. For example, with `-fbackslash' in effect, `A\nB' specifies three characters, with the second one being newline. With `-fno-backslash', it specifies four characters, `A', `\', `n', and `B'. Note that `g77' implements a fairly general form of backslash processing that is incompatible with the narrower forms supported by some other compilers. For example, `'A\003B'' is a three-character string in `g77' whereas other compilers that support backslash might not support the three-octal-digit form, and thus treat that string as longer than three characters. *Note Backslash in Constants::, for information on why `-fbackslash' is the default instead of `-fno-backslash'. `-fno-ugly-args' Disallow passing Hollerith and typeless constants as actual arguments (for example, `CALL FOO(4HABCD)'). *Note Ugly Implicit Argument Conversion::, for more information. `-fugly-assign' Use the same storage for a given variable regardless of whether it is used to hold an assigned-statement label (as in `ASSIGN 10 TO I') or used to hold numeric data (as in `I = 3'). *Note Ugly Assigned Labels::, for more information. `-fugly-assumed' Assume any dummy array with a final dimension specified as `1' is really an assumed-size array, as if `*' had been specified for the final dimension instead of `1'. For example, `DIMENSION X(1)' is treated as if it had read `DIMENSION X(*)'. *Note Ugly Assumed-Size Arrays::, for more information. `-fugly-comma' In an external-procedure invocation, treat a trailing comma in the argument list as specification of a trailing null argument, and treat an empty argument list as specification of a single null argument. For example, `CALL FOO(,)' is treated as `CALL FOO(%VAL(0), %VAL(0))'. That is, _two_ null arguments are specified by the procedure call when `-fugly-comma' is in force. And `F = FUNC()' is treated as `F = FUNC(%VAL(0))'. The default behavior, `-fno-ugly-comma', is to ignore a single trailing comma in an argument list. So, by default, `CALL FOO(X,)' is treated exactly the same as `CALL FOO(X)'. *Note Ugly Null Arguments::, for more information. `-fugly-complex' Do not complain about `REAL(EXPR)' or `AIMAG(EXPR)' when EXPR is a `COMPLEX' type other than `COMPLEX(KIND=1)'--usually this is used to permit `COMPLEX(KIND=2)' (`DOUBLE COMPLEX') operands. The `-ff90' option controls the interpretation of this construct. *Note Ugly Complex Part Extraction::, for more information. `-fno-ugly-init' Disallow use of Hollerith and typeless constants as initial values (in `PARAMETER' and `DATA' statements), and use of character constants to initialize numeric types and vice versa. For example, `DATA I/'F'/, CHRVAR/65/, J/4HABCD/' is disallowed by `-fno-ugly-init'. *Note Ugly Conversion of Initializers::, for more information. `-fugly-logint' Treat `INTEGER' and `LOGICAL' variables and expressions as potential stand-ins for each other. For example, automatic conversion between `INTEGER' and `LOGICAL' is enabled, for many contexts, via this option. *Note Ugly Integer Conversions::, for more information. `-fonetrip' Executable iterative `DO' loops are to be executed at least once each time they are reached. ANSI FORTRAN 77 and more recent versions of the Fortran standard specify that the body of an iterative `DO' loop is not executed if the number of iterations calculated from the parameters of the loop is less than 1. (For example, `DO 10 I = 1, 0'.) Such a loop is called a "zero-trip loop". Prior to ANSI FORTRAN 77, many compilers implemented `DO' loops such that the body of a loop would be executed at least once, even if the iteration count was zero. Fortran code written assuming this behavior is said to require "one-trip loops". For example, some code written to the FORTRAN 66 standard expects this behavior from its `DO' loops, although that standard did not specify this behavior. The `-fonetrip' option specifies that the source file(s) being compiled require one-trip loops. This option affects only those loops specified by the (iterative) `DO' statement and by implied-`DO' lists in I/O statements. Loops specified by implied-`DO' lists in `DATA' and specification (non-executable) statements are not affected. `-ftypeless-boz' Specifies that prefix-radix non-decimal constants, such as `Z'ABCD'', are typeless instead of `INTEGER(KIND=1)'. You can test for yourself whether a particular compiler treats the prefix form as `INTEGER(KIND=1)' or typeless by running the following program: EQUIVALENCE (I, R) R = Z'ABCD1234' J = Z'ABCD1234' IF (J .EQ. I) PRINT *, 'Prefix form is TYPELESS' IF (J .NE. I) PRINT *, 'Prefix form is INTEGER' END Reports indicate that many compilers process this form as `INTEGER(KIND=1)', though a few as typeless, and at least one based on a command-line option specifying some kind of compatibility. `-fintrin-case-initcap' `-fintrin-case-upper' `-fintrin-case-lower' `-fintrin-case-any' Specify expected case for intrinsic names. `-fintrin-case-lower' is the default. `-fmatch-case-initcap' `-fmatch-case-upper' `-fmatch-case-lower' `-fmatch-case-any' Specify expected case for keywords. `-fmatch-case-lower' is the default. `-fsource-case-upper' `-fsource-case-lower' `-fsource-case-preserve' Specify whether source text other than character and Hollerith constants is to be translated to uppercase, to lowercase, or preserved as is. `-fsource-case-lower' is the default. `-fsymbol-case-initcap' `-fsymbol-case-upper' `-fsymbol-case-lower' `-fsymbol-case-any' Specify valid cases for user-defined symbol names. `-fsymbol-case-any' is the default. `-fcase-strict-upper' Same as `-fintrin-case-upper -fmatch-case-upper -fsource-case-preserve -fsymbol-case-upper'. (Requires all pertinent source to be in uppercase.) `-fcase-strict-lower' Same as `-fintrin-case-lower -fmatch-case-lower -fsource-case-preserve -fsymbol-case-lower'. (Requires all pertinent source to be in lowercase.) `-fcase-initcap' Same as `-fintrin-case-initcap -fmatch-case-initcap -fsource-case-preserve -fsymbol-case-initcap'. (Requires all pertinent source to be in initial capitals, as in `Print *,SqRt(Value)'.) `-fcase-upper' Same as `-fintrin-case-any -fmatch-case-any -fsource-case-upper -fsymbol-case-any'. (Maps all pertinent source to uppercase.) `-fcase-lower' Same as `-fintrin-case-any -fmatch-case-any -fsource-case-lower -fsymbol-case-any'. (Maps all pertinent source to lowercase.) `-fcase-preserve' Same as `-fintrin-case-any -fmatch-case-any -fsource-case-preserve -fsymbol-case-any'. (Preserves all case in user-defined symbols, while allowing any-case matching of intrinsics and keywords. For example, `call Foo(i,I)' would pass two _different_ variables named `i' and `I' to a procedure named `Foo'.) `-fbadu77-intrinsics-delete' `-fbadu77-intrinsics-hide' `-fbadu77-intrinsics-disable' `-fbadu77-intrinsics-enable' Specify status of UNIX intrinsics having inappropriate forms. `-fbadu77-intrinsics-enable' is the default. *Note Intrinsic Groups::. `-ff2c-intrinsics-delete' `-ff2c-intrinsics-hide' `-ff2c-intrinsics-disable' `-ff2c-intrinsics-enable' Specify status of f2c-specific intrinsics. `-ff2c-intrinsics-enable' is the default. *Note Intrinsic Groups::. `-ff90-intrinsics-delete' `-ff90-intrinsics-hide' `-ff90-intrinsics-disable' `-ff90-intrinsics-enable' Specify status of F90-specific intrinsics. `-ff90-intrinsics-enable' is the default. *Note Intrinsic Groups::. `-fgnu-intrinsics-delete' `-fgnu-intrinsics-hide' `-fgnu-intrinsics-disable' `-fgnu-intrinsics-enable' Specify status of Digital's COMPLEX-related intrinsics. `-fgnu-intrinsics-enable' is the default. *Note Intrinsic Groups::. `-fmil-intrinsics-delete' `-fmil-intrinsics-hide' `-fmil-intrinsics-disable' `-fmil-intrinsics-enable' Specify status of MIL-STD-1753-specific intrinsics. `-fmil-intrinsics-enable' is the default. *Note Intrinsic Groups::. `-funix-intrinsics-delete' `-funix-intrinsics-hide' `-funix-intrinsics-disable' `-funix-intrinsics-enable' Specify status of UNIX intrinsics. `-funix-intrinsics-enable' is the default. *Note Intrinsic Groups::. `-fvxt-intrinsics-delete' `-fvxt-intrinsics-hide' `-fvxt-intrinsics-disable' `-fvxt-intrinsics-enable' Specify status of VXT intrinsics. `-fvxt-intrinsics-enable' is the default. *Note Intrinsic Groups::. `-ffixed-line-length-N' Set column after which characters are ignored in typical fixed-form lines in the source file, and through which spaces are assumed (as if padded to that length) after the ends of short fixed-form lines. Popular values for N include 72 (the standard and the default), 80 (card image), and 132 (corresponds to "extended-source" options in some popular compilers). N may be `none', meaning that the entire line is meaningful and that continued character constants never have implicit spaces appended to them to fill out the line. `-ffixed-line-length-0' means the same thing as `-ffixed-line-length-none'. *Note Source Form::, for more information.  File: g77.info, Node: Warning Options, Next: Debugging Options, Prev: Fortran Dialect Options, Up: Invoking G77 Options to Request or Suppress Warnings ======================================= Warnings are diagnostic messages that report constructions which are not inherently erroneous but which are risky or suggest there might have been an error. You can request many specific warnings with options beginning `-W', for example `-Wimplicit' to request warnings on implicit declarations. Each of these specific warning options also has a negative form beginning `-Wno-' to turn off warnings; for example, `-Wno-implicit'. This manual lists only one of the two forms, whichever is not the default. These options control the amount and kinds of warnings produced by GNU Fortran: `-fsyntax-only' Check the code for syntax errors, but don't do anything beyond that. `-pedantic' Issue warnings for uses of extensions to ANSI FORTRAN 77. `-pedantic' also applies to C-language constructs where they occur in GNU Fortran source files, such as use of `\e' in a character constant within a directive like `#include'. Valid ANSI FORTRAN 77 programs should compile properly with or without this option. However, without this option, certain GNU extensions and traditional Fortran features are supported as well. With this option, many of them are rejected. Some users try to use `-pedantic' to check programs for strict ANSI conformance. They soon find that it does not do quite what they want--it finds some non-ANSI practices, but not all. However, improvements to `g77' in this area are welcome. `-pedantic-errors' Like `-pedantic', except that errors are produced rather than warnings. `-fpedantic' Like `-pedantic', but applies only to Fortran constructs. `-w' Inhibit all warning messages. `-Wno-globals' Inhibit warnings about use of a name as both a global name (a subroutine, function, or block data program unit, or a common block) and implicitly as the name of an intrinsic in a source file. Also inhibit warnings about inconsistent invocations and/or definitions of global procedures (function and subroutines). Such inconsistencies include different numbers of arguments and different types of arguments. `-Wimplicit' Warn whenever a variable, array, or function is implicitly declared. Has an effect similar to using the `IMPLICIT NONE' statement in every program unit. (Some Fortran compilers provide this feature by an option named `-u' or `/WARNINGS=DECLARATIONS'.) `-Wunused' Warn whenever a variable is unused aside from its declaration. `-Wuninitialized' Warn whenever an automatic variable is used without first being initialized. These warnings are possible only in optimizing compilation, because they require data-flow information that is computed only when optimizing. If you don't specify `-O', you simply won't get these warnings. These warnings occur only for variables that are candidates for register allocation. Therefore, they do not occur for a variable whose address is taken, or whose size is other than 1, 2, 4 or 8 bytes. Also, they do not occur for arrays, even when they are in registers. Note that there might be no warning about a variable that is used only to compute a value that itself is never used, because such computations may be deleted by data-flow analysis before the warnings are printed. These warnings are made optional because GNU Fortran is not smart enough to see all the reasons why the code might be correct despite appearing to have an error. Here is one example of how this can happen: SUBROUTINE DISPAT(J) IF (J.EQ.1) I=1 IF (J.EQ.2) I=4 IF (J.EQ.3) I=5 CALL FOO(I) END If the value of `J' is always 1, 2 or 3, then `I' is always initialized, but GNU Fortran doesn't know this. Here is another common case: SUBROUTINE MAYBE(FLAG) LOGICAL FLAG IF (FLAG) VALUE = 9.4 ... IF (FLAG) PRINT *, VALUE END This has no bug because `VALUE' is used only if it is set. `-Wall' The `-Wunused' and `-Wuninitialized' options combined. These are all the options which pertain to usage that we recommend avoiding and that we believe is easy to avoid. (As more warnings are added to `g77' some might be added to the list enabled by `-Wall'.) The remaining `-W...' options are not implied by `-Wall' because they warn about constructions that we consider reasonable to use, on occasion, in clean programs. `-Wsurprising' Warn about "suspicious" constructs that are interpreted by the compiler in a way that might well be surprising to someone reading the code. These differences can result in subtle, compiler-dependent (even machine-dependent) behavioral differences. The constructs warned about include: * Expressions having two arithmetic operators in a row, such as `X*-Y'. Such a construct is nonstandard, and can produce unexpected results in more complicated situations such as `X**-Y*Z'. `g77' along with many other compilers, interprets this example differently than many programmers, and a few other compilers. Specifically, `g77' interprets `X**-Y*Z' as `(X**(-Y))*Z', while others might think it should be interpreted as `X**(-(Y*Z))'. A revealing example is the constant expression `2**-2*1.', which `g77' evaluates to .25, while others might evaluate it to 0., the difference resulting from the way precedence affects type promotion. (The `-fpedantic' option also warns about expressions having two arithmetic operators in a row.) * Expressions with a unary minus followed by an operand and then a binary operator other than plus or minus. For example, `-2**2' produces a warning, because the precedence is `-(2**2)', yielding -4, not `(-2)**2', which yields 4, and which might represent what a programmer expects. An example of an expression producing different results in a surprising way is `-I*S', where I holds the value `-2147483648' and S holds `0.5'. On many systems, negating I results in the same value, not a positive number, because it is already the lower bound of what an `INTEGER(KIND=1)' variable can hold. So, the expression evaluates to a positive number, while the "expected" interpretation, `(-I)*S', would evaluate to a negative number. Even cases such as `-I*J' produce warnings, even though, in most configurations and situations, there is no computational difference between the results of the two interpretations--the purpose of this warning is to warn about differing interpretations and encourage a better style of coding, not to identify only those places where bugs might exist in the user's code. * `DO' loops with `DO' variables that are not of integral type--that is, using `REAL' variables as loop control variables. Although such loops can be written to work in the "obvious" way, the way `g77' is required by the Fortran standard to interpret such code is likely to be quite different from the way many programmers expect. (This is true of all `DO' loops, but the differences are pronounced for non-integral loop control variables.) *Note Loops::, for more information. `-Werror' Make all warnings into errors. `-W' Turns on "extra warnings" and, if optimization is specified via `-O', the `-Wuninitialized' option. (This might change in future versions of `g77' "Extra warnings" are issued for: * Unused parameters to a procedure (when `-Wunused' also is specified). * Overflows involving floating-point constants (not available for certain configurations). *Note Options to Request or Suppress Warnings: (gcc)Warning Options, for information on more options offered by the GBE shared by `g77' `gcc' and other GNU compilers. Some of these have no effect when compiling programs written in Fortran: `-Wcomment' `-Wformat' `-Wparentheses' `-Wswitch' `-Wtraditional' `-Wshadow' `-Wid-clash-LEN' `-Wlarger-than-LEN' `-Wconversion' `-Waggregate-return' `-Wredundant-decls' These options all could have some relevant meaning for GNU Fortran programs, but are not yet supported.