| This is Info file g77.info, produced by Makeinfo version 1.68 from the |
| input file g77.texi. |
| |
| This file explains how to use the GNU Fortran system. |
| |
| Published by the Free Software Foundation 59 Temple Place - Suite 330 |
| Boston, MA 02111-1307 USA |
| |
| Copyright (C) 1995-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 also |
| that the sections entitled "GNU General Public License," "Funding for |
| Free Software," and "Protect Your Freedom--Fight `Look And Feel'" are |
| included exactly as in the original, and 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 the sections entitled "GNU General Public |
| License," "Funding for Free Software," and "Protect Your Freedom--Fight |
| `Look And Feel'", and this permission notice, may be included in |
| translations approved by the Free Software Foundation instead of in the |
| original English. |
| |
| Contributed by James Craig Burley (<burley@gnu.org>). Inspired by a |
| first pass at translating `g77-0.5.16/f/DOC' that was contributed to |
| Craig by David Ronis (<ronis@onsager.chem.mcgill.ca>). |
| |
| INFO-DIR-SECTION Fortran Programming |
| START-INFO-DIR-ENTRY |
| * g77: (g77). The GNU Fortran compilation system. |
| END-INFO-DIR-ENTRY |
| |
| |
| File: g77.info, Node: Code Gen Options, Next: Environment Variables, Prev: Directory Options, Up: Invoking G77 |
| |
| Options for Code Generation Conventions |
| ======================================= |
| |
| These machine-independent options control the interface conventions |
| used in code generation. |
| |
| Most of them have both positive and negative forms; the negative form |
| of `-ffoo' would be `-fno-foo'. In the table below, only one of the |
| forms is listed--the one which is not the default. You can figure out |
| the other form by either removing `no-' or adding it. |
| |
| `-fno-automatic' |
| Treat each program unit as if the `SAVE' statement was specified |
| for every local variable and array referenced in it. Does not |
| affect common blocks. (Some Fortran compilers provide this option |
| under the name `-static'.) |
| |
| `-finit-local-zero' |
| Specify that variables and arrays that are local to a program unit |
| (not in a common block and not passed as an argument) are to be |
| initialized to binary zeros. |
| |
| Since there is a run-time penalty for initialization of variables |
| that are not given the `SAVE' attribute, it might be a good idea |
| to also use `-fno-automatic' with `-finit-local-zero'. |
| |
| `-fno-f2c' |
| Do not generate code designed to be compatible with code generated |
| by `f2c'; use the GNU calling conventions instead. |
| |
| The `f2c' calling conventions require functions that return type |
| `REAL(KIND=1)' to actually return the C type `double', and |
| functions that return type `COMPLEX' to return the values via an |
| extra argument in the calling sequence that points to where to |
| store the return value. Under the GNU calling conventions, such |
| functions simply return their results as they would in GNU |
| C--`REAL(KIND=1)' functions return the C type `float', and |
| `COMPLEX' functions return the GNU C type `complex' (or its |
| `struct' equivalent). |
| |
| This does not affect the generation of code that interfaces with |
| the `libf2c' library. |
| |
| However, because the `libf2c' library uses `f2c' calling |
| conventions, `g77' rejects attempts to pass intrinsics implemented |
| by routines in this library as actual arguments when `-fno-f2c' is |
| used, to avoid bugs when they are actually called by code |
| expecting the GNU calling conventions to work. |
| |
| For example, `INTRINSIC ABS;CALL FOO(ABS)' is rejected when |
| `-fno-f2c' is in force. (Future versions of the `g77' run-time |
| library might offer routines that provide GNU-callable versions of |
| the routines that implement the `f2c'-callable intrinsics that may |
| be passed as actual arguments, so that valid programs need not be |
| rejected when `-fno-f2c' is used.) |
| |
| *Caution:* If `-fno-f2c' is used when compiling any source file |
| used in a program, it must be used when compiling *all* Fortran |
| source files used in that program. |
| |
| `-ff2c-library' |
| Specify that use of `libf2c' is required. This is the default for |
| the current version of `g77'. |
| |
| Currently it is not valid to specify `-fno-f2c-library'. This |
| option is provided so users can specify it in shell scripts that |
| build programs and libraries that require the `libf2c' library, |
| even when being compiled by future versions of `g77' that might |
| otherwise default to generating code for an incompatible library. |
| |
| `-fno-underscoring' |
| Do not transform names of entities specified in the Fortran source |
| file by appending underscores to them. |
| |
| With `-funderscoring' in effect, `g77' appends two underscores to |
| names with underscores and one underscore to external names with |
| no underscores. (`g77' also appends two underscores to internal |
| names with underscores to avoid naming collisions with external |
| names. The `-fno-second-underscore' option disables appending of |
| the second underscore in all cases.) |
| |
| This is done to ensure compatibility with code produced by many |
| UNIX Fortran compilers, including `f2c', which perform the same |
| transformations. |
| |
| Use of `-fno-underscoring' is not recommended unless you are |
| experimenting with issues such as integration of (GNU) Fortran into |
| existing system environments (vis-a-vis existing libraries, tools, |
| and so on). |
| |
| For example, with `-funderscoring', and assuming other defaults |
| like `-fcase-lower' and that `j()' and `max_count()' are external |
| functions while `my_var' and `lvar' are local variables, a |
| statement like |
| |
| I = J() + MAX_COUNT (MY_VAR, LVAR) |
| |
| is implemented as something akin to: |
| |
| i = j_() + max_count__(&my_var__, &lvar); |
| |
| With `-fno-underscoring', the same statement is implemented as: |
| |
| i = j() + max_count(&my_var, &lvar); |
| |
| Use of `-fno-underscoring' allows direct specification of |
| user-defined names while debugging and when interfacing |
| `g77'-compiled code with other languages. |
| |
| Note that just because the names match does *not* mean that the |
| interface implemented by `g77' for an external name matches the |
| interface implemented by some other language for that same name. |
| That is, getting code produced by `g77' to link to code produced |
| by some other compiler using this or any other method can be only a |
| small part of the overall solution--getting the code generated by |
| both compilers to agree on issues other than naming can require |
| significant effort, and, unlike naming disagreements, linkers |
| normally cannot detect disagreements in these other areas. |
| |
| Also, note that with `-fno-underscoring', the lack of appended |
| underscores introduces the very real possibility that a |
| user-defined external name will conflict with a name in a system |
| library, which could make finding unresolved-reference bugs quite |
| difficult in some cases--they might occur at program run time, and |
| show up only as buggy behavior at run time. |
| |
| In future versions of `g77', we hope to improve naming and linking |
| issues so that debugging always involves using the names as they |
| appear in the source, even if the names as seen by the linker are |
| mangled to prevent accidental linking between procedures with |
| incompatible interfaces. |
| |
| `-fno-second-underscore' |
| Do not append a second underscore to names of entities specified |
| in the Fortran source file. |
| |
| This option has no effect if `-fno-underscoring' is in effect. |
| |
| Otherwise, with this option, an external name such as `MAX_COUNT' |
| is implemented as a reference to the link-time external symbol |
| `max_count_', instead of `max_count__'. |
| |
| `-fno-ident' |
| Ignore the `#ident' directive. |
| |
| `-fzeros' |
| Treat initial values of zero as if they were any other value. |
| |
| As of version 0.5.18, `g77' normally treats `DATA' and other |
| statements that are used to specify initial values of zero for |
| variables and arrays as if no values were actually specified, in |
| the sense that no diagnostics regarding multiple initializations |
| are produced. |
| |
| This is done to speed up compiling of programs that initialize |
| large arrays to zeros. |
| |
| Use `-fzeros' to revert to the simpler, slower behavior that can |
| catch multiple initializations by keeping track of all |
| initializations, zero or otherwise. |
| |
| *Caution:* Future versions of `g77' might disregard this option |
| (and its negative form, the default) or interpret it somewhat |
| differently. The interpretation changes will affect only |
| non-standard programs; standard-conforming programs should not be |
| affected. |
| |
| `-fdebug-kludge' |
| Emit information on `COMMON' and `EQUIVALENCE' members that might |
| help users of debuggers work around lack of proper debugging |
| information on such members. |
| |
| As of version 0.5.19, `g77' offers this option to emit information |
| on members of aggregate areas to help users while debugging. This |
| information consists of establishing the type and contents of each |
| such member so that, when a debugger is asked to print the |
| contents, the printed information provides rudimentary debugging |
| information. This information identifies the name of the |
| aggregate area (either the `COMMON' block name, or the |
| `g77'-assigned name for the `EQUIVALENCE' name) and the offset, in |
| bytes, of the member from the beginning of the area. |
| |
| Using `gdb', this information is not coherently displayed in the |
| Fortran language mode, so temporarily switching to the C language |
| mode to display the information is suggested. Use `set language |
| c' and `set language fortran' to accomplish this. |
| |
| For example: |
| |
| COMMON /X/A,B |
| EQUIVALENCE (C,D) |
| CHARACTER XX*50 |
| EQUIVALENCE (I,XX(20:20)) |
| END |
| |
| GDB is free software and you are welcome to distribute copies of it |
| under certain conditions; type "show copying" to see the conditions. |
| There is absolutely no warranty for GDB; type "show warranty" for details. |
| GDB 4.16 (lm-gnits-dwim), Copyright 1996 Free Software Foundation, Inc... |
| (gdb) b MAIN__ |
| Breakpoint 1 at 0t1200000201120112: file cd.f, line 5. |
| (gdb) r |
| Starting program: /home/user/a.out |
| |
| Breakpoint 1, MAIN__ () at cd.f:5 |
| Current language: auto; currently fortran |
| (gdb) set language c |
| Warning: the current language does not match this frame. |
| (gdb) p a |
| $2 = "At (COMMON) `x_' plus 0 bytes" |
| (gdb) p b |
| $3 = "At (COMMON) `x_' plus 4 bytes" |
| (gdb) p c |
| $4 = "At (EQUIVALENCE) `__g77_equiv_c' plus 0 bytes" |
| (gdb) p d |
| $5 = "At (EQUIVALENCE) `__g77_equiv_c' plus 0 bytes" |
| (gdb) p i |
| $6 = "At (EQUIVALENCE) `__g77_equiv_xx' plus 20 bytes" |
| (gdb) p xx |
| $7 = "At (EQUIVALENCE) `__g77_equiv_xx' plus 1 bytes" |
| (gdb) set language fortran |
| (gdb) |
| |
| Use `-fdebug-kludge' to generate this information, which might |
| make some programs noticeably larger. |
| |
| *Caution:* Future versions of `g77' might disregard this option |
| (and its negative form). Current plans call for this to happen |
| when published versions of `g77' and `gdb' exist that provide |
| proper access to debugging information on `COMMON' and |
| `EQUIVALENCE' members. |
| |
| `-fno-emulate-complex' |
| Implement `COMPLEX' arithmetic using the facilities in the `gcc' |
| back end that provide direct support of `complex' arithmetic, |
| instead of emulating the arithmetic. |
| |
| `gcc' has some known problems in its back-end support for |
| `complex' arithmetic, due primarily to the support not being |
| completed as of version 2.7.2.2. Other front ends for the `gcc' |
| back end avoid this problem by emulating `complex' arithmetic at a |
| higher level, so the back end sees arithmetic on the real and |
| imaginary components. To make `g77' more portable to systems |
| where `complex' support in the `gcc' back end is particularly |
| troublesome, `g77' now defaults to performing the same kinds of |
| emulations done by these other front ends. |
| |
| Use `-fno-emulate-complex' to try the `complex' support in the |
| `gcc' back end, in case it works and produces faster programs. So |
| far, all the known bugs seem to involve compile-time crashes, |
| rather than the generation of incorrect code. |
| |
| Use of this option should not affect how Fortran code compiled by |
| `g77' works in terms of its interfaces to other code, e.g. that |
| compiled by `f2c'. |
| |
| *Caution:* Future versions of `g77' are likely to change the |
| default for this option to `-fno-emulate-complex', and perhaps |
| someday ignore both forms of this option. |
| |
| Also, it is possible that use of the `-fno-emulate-complex' option |
| could result in incorrect code being silently produced by `g77'. |
| But, this is generally true of compilers anyway, so, as usual, test |
| the programs you compile before assuming they are working. |
| |
| `-falias-check' |
| |
| `-fargument-alias' |
| |
| `-fargument-noalias' |
| |
| `-fno-argument-noalias-global' |
| These options specify to what degree aliasing (overlap) is |
| permitted between arguments (passed as pointers) and `COMMON' |
| (external, or public) storage. |
| |
| The default for Fortran code, as mandated by the FORTRAN 77 and |
| Fortran 90 standards, is `-fargument-noalias-global'. The default |
| for code written in the C language family is `-fargument-alias'. |
| |
| Note that, on some systems, compiling with `-fforce-addr' in |
| effect can produce more optimal code when the default aliasing |
| options are in effect (and when optimization is enabled). |
| |
| *Note Aliasing Assumed To Work::, for detailed information on the |
| implications of compiling Fortran code that depends on the ability |
| to alias dummy arguments. |
| |
| `-fno-globals' |
| Disable diagnostics about inter-procedural analysis problems, such |
| as disagreements about the type of a function or a procedure's |
| argument, that might cause a compiler crash when attempting to |
| inline a reference to a procedure within a program unit. (The |
| diagnostics themselves are still produced, but as warnings, unless |
| `-Wno-globals' is specified, in which case no relevant diagnostics |
| are produced.) |
| |
| Further, this option disables such inlining, to avoid compiler |
| crashes resulting from incorrect code that would otherwise be |
| diagnosed. |
| |
| As such, this option might be quite useful when compiling |
| existing, "working" code that happens to have a few bugs that do |
| not generally show themselves, but `g77' exposes via a diagnostic. |
| |
| Use of this option therefore has the effect of instructing `g77' |
| to behave more like it did up through version 0.5.19.1, when it |
| paid little or no attention to disagreements between program units |
| about a procedure's type and argument information, and when it |
| performed no inlining of procedures (except statement functions). |
| |
| Without this option, `g77' defaults to performing the potentially |
| inlining procedures as it started doing in version 0.5.20, but as |
| of version 0.5.21, it also diagnoses disagreements that might |
| cause such inlining to crash the compiler. |
| |
| *Note Options for Code Generation Conventions: (gcc)Code Gen |
| Options, for information on more options offered by the GBE shared by |
| `g77', `gcc', and other GNU compilers. |
| |
| Some of these do *not* work when compiling programs written in |
| Fortran: |
| |
| `-fpcc-struct-return' |
| |
| `-freg-struct-return' |
| You should not use these except strictly the same way as you used |
| them to build the version of `libf2c' with which you will be |
| linking all code compiled by `g77' with the same option. |
| |
| `-fshort-double' |
| This probably either has no effect on Fortran programs, or makes |
| them act loopy. |
| |
| `-fno-common' |
| Do not use this when compiling Fortran programs, or there will be |
| Trouble. |
| |
| `-fpack-struct' |
| This probably will break any calls to the `libf2c' library, at the |
| very least, even if it is built with the same option. |
| |
| |
| File: g77.info, Node: Environment Variables, Prev: Code Gen Options, Up: Invoking G77 |
| |
| Environment Variables Affecting GNU Fortran |
| =========================================== |
| |
| GNU Fortran currently does not make use of any environment variables |
| to control its operation above and beyond those that affect the |
| operation of `gcc'. |
| |
| *Note Environment Variables Affecting GNU CC: (gcc)Environment |
| Variables, for information on environment variables. |
| |