This is Info file f/g77.info, produced by Makeinfo version 1.68 from the input file ../../../src/gcc-2.95.3/gcc/f/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-2.95 version of `g77'. Published by the Free Software Foundation 59 Temple Place - Suite 330 Boston, MA 02111-1307 USA Copyright (C) 1995-1999 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 (). 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: Top, Next: Copying, Up: (DIR) Introduction ************ This manual documents how to run, install and port `g77', as well as its new features and incompatibilities, and how to report bugs. It corresponds to the GCC-2.95 version of `g77'. * Menu: * Copying:: GNU General Public License says how you can copy and share GNU Fortran. * Contributors:: People who have contributed to GNU Fortran. * Funding:: How to help assure continued work for free software. * Funding GNU Fortran:: How to help assure continued work on GNU Fortran. * Look and Feel:: Protect your freedom--fight "look and feel". * Getting Started:: Finding your way around this manual. * What is GNU Fortran?:: How `g77' fits into the universe. * G77 and GCC:: You can compile Fortran, C, or other programs. * Invoking G77:: Command options supported by `g77'. * News:: News about recent releases of `g77'. * Changes:: User-visible changes to recent releases of `g77'. * Language:: The GNU Fortran language. * Compiler:: The GNU Fortran compiler. * Other Dialects:: Dialects of Fortran supported by `g77'. * Other Compilers:: Fortran compilers other than `g77'. * Other Languages:: Languages other than Fortran. * Installation:: How to configure, compile and install GNU Fortran. * Debugging and Interfacing:: How `g77' generates code. * Collected Fortran Wisdom:: How to avoid Trouble. * Trouble:: If you have trouble with GNU Fortran. * Open Questions:: Things we'd like to know. * Bugs:: How, why, and where to report bugs. * Service:: How to find suppliers of support for GNU Fortran. * Adding Options:: Guidance on teaching `g77' about new options. * Projects:: Projects for `g77' internals hackers. * Front End:: Design and implementation of the `g77' front end. * M: Diagnostics. Diagnostics produced by `g77'. * Index:: Index of concepts and symbol names.  File: g77.info, Node: Copying, Next: Contributors, Prev: Top, Up: Top GNU GENERAL PUBLIC LICENSE ************************** Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble ======== The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a. You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b. You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c. If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a. Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b. Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c. Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs ============================================= If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES. Copyright (C) 19YY NAME OF AUTHOR This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19YY NAME OF AUTHOR Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. SIGNATURE OF TY COON, 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License.  File: g77.info, Node: Contributors, Next: Funding, Prev: Copying, Up: Top Contributors to GNU Fortran *************************** In addition to James Craig Burley, who wrote the front end, many people have helped create and improve GNU Fortran. * The packaging and compiler portions of GNU Fortran are based largely on the GNU CC compiler. *Note Contributors to GNU CC: (gcc)Contributors, for more information. * The run-time library used by GNU Fortran is a repackaged version of the `libf2c' library (combined from the `libF77' and `libI77' libraries) provided as part of `f2c', available for free from `netlib' sites on the Internet. * Cygnus Support and The Free Software Foundation contributed significant money and/or equipment to Craig's efforts. * The following individuals served as alpha testers prior to `g77''s public release. This work consisted of testing, researching, sometimes debugging, and occasionally providing small amounts of code and fixes for `g77', plus offering plenty of helpful advice to Craig: Jonathan Corbet Dr. Mark Fernyhough Takafumi Hayashi (The University of Aizu)-- Kate Hedstrom Michel Kern (INRIA and Rice University)-- Dr. A. O. V. Le Blanc Dave Love Rick Lutowski Toon Moene Rick Niles Derk Reefman Wayne K. Schroll Bill Thorson Pedro A. M. Vazquez Ian Watson * Scott Snyder () provided the patch to add rudimentary support for `INTEGER*1', `INTEGER*2', and `LOGICAL*1'. This inspired Craig to add further support, even though the resulting support would still be incomplete, because version 0.6 is still a ways off. * David Ronis () inspired and encouraged Craig to rewrite the documentation in texinfo format by contributing a first pass at a translation of the old `g77-0.5.16/f/DOC' file. * Toon Moene () performed some analysis of generated code as part of an overall project to improve `g77' code generation to at least be as good as `f2c' used in conjunction with `gcc'. So far, this has resulted in the three, somewhat experimental, options added by `g77' to the `gcc' compiler and its back end. (These, in turn, have made their way into the `egcs' version of the compiler, and do not exist in `gcc' version 2.8 or versions of `g77' based on that version of `gcc'.) * John Carr () wrote the alias analysis improvements. * Thanks to Mary Cortani and the staff at Craftwork Solutions () for all of their support. * Many other individuals have helped debug, test, and improve `g77' over the past several years, and undoubtedly more people will be doing so in the future. If you have done so, and would like to see your name listed in the above list, please ask! The default is that people wish to remain anonymous.  File: g77.info, Node: Funding, Next: Funding GNU Fortran, Prev: Contributors, Up: Top Funding Free Software ********************* If you want to have more free software a few years from now, it makes sense for you to help encourage people to contribute funds for its development. The most effective approach known is to encourage commercial redistributors to donate. Users of free software systems can boost the pace of development by encouraging for-a-fee distributors to donate part of their selling price to free software developers--the Free Software Foundation, and others. The way to convince distributors to do this is to demand it and expect it from them. So when you compare distributors, judge them partly by how much they give to free software development. Show distributors they must compete to be the one who gives the most. To make this approach work, you must insist on numbers that you can compare, such as, "We will donate ten dollars to the Frobnitz project for each disk sold." Don't be satisfied with a vague promise, such as "A portion of the profits are donated," since it doesn't give a basis for comparison. Even a precise fraction "of the profits from this disk" is not very meaningful, since creative accounting and unrelated business decisions can greatly alter what fraction of the sales price counts as profit. If the price you pay is $50, ten percent of the profit is probably less than a dollar; it might be a few cents, or nothing at all. Some redistributors do development work themselves. This is useful too; but to keep everyone honest, you need to inquire how much they do, and what kind. Some kinds of development make much more long-term difference than others. For example, maintaining a separate version of a program contributes very little; maintaining the standard version of a program for the whole community contributes much. Easy new ports contribute little, since someone else would surely do them; difficult ports such as adding a new CPU to the GNU C compiler contribute more; major new features or packages contribute the most. By establishing the idea that supporting further development is "the proper thing to do" when distributing free software for a fee, we can assure a steady flow of resources into making more free software. Copyright (C) 1994 Free Software Foundation, Inc. Verbatim copying and redistribution of this section is permitted without royalty; alteration is not permitted.  File: g77.info, Node: Funding GNU Fortran, Next: Look and Feel, Prev: Funding, Up: Top Funding GNU Fortran ******************* Work on GNU Fortran is still being done mostly by its author, James Craig Burley (), who is a volunteer for, not an employee of, the Free Software Foundation (FSF). (He has a web page at `http://world.std.com/%7Eburley'.) As with other GNU software, funding is important because it can pay for needed equipment, personnel, and so on. The FSF provides information on the best way to fund ongoing development of GNU software (such as GNU Fortran) in documents such as the "GNUS Bulletin". Email for information on funding the FSF. To fund specific GNU Fortran work in particular, the FSF might provide a means for that, but the FSF does not provide direct funding to the author of GNU Fortran to continue his work. The FSF has employee salary restrictions that can be incompatible with the financial needs of some volunteers, who therefore choose to remain volunteers and thus be able to be free to do contract work and otherwise make their own schedules for doing GNU work. Still, funding the FSF at least indirectly benefits work on specific projects like GNU Fortran because it ensures the continuing operation of the FSF offices, their workstations, their network connections, and so on, which are invaluable to volunteers. (Similarly, hiring Cygnus Support can help a project like GNU Fortran--Cygnus has been a long-time donor of equipment usage to the author of GNU Fortran, and this too has been invaluable--see *Note Contributors::.) Currently, the only way to directly fund the author of GNU Fortran in his work on that project is to hire him for the work you want him to do, or donate money to him. Several people have done this already, with the result that he has not needed to immediately find contract work on a few occasions. If more people did this, he would be able to plan on not doing contract work for many months and could thus devote that time to work on projects (such as the planned changes for 0.6) that require longer timeframes to complete. For the latest information on the status of the author, do `finger -l burley@gnu.org' on a UNIX system (or any system with a command like UNIX `finger'). Another important way to support work on GNU Fortran is to volunteer to help out. Work is needed on documentation, testing, porting to various machines, and in some cases, coding (although major changes planned for version 0.6 make it difficult to add manpower to this area). Email to volunteer for this work. *Note Funding Free Software: Funding, for more information.  File: g77.info, Node: Look and Feel, Next: Getting Started, Prev: Funding GNU Fortran, Up: Top Protect Your Freedom--Fight "Look And Feel" ******************************************* To preserve the ability to write free software, including replacements for proprietary software, authors must be free to replicate the user interface to which users of existing software have become accustomed. *Note Protect Your Freedom--Fight "Look And Feel": (gcc)Look and Feel, for more information.  File: g77.info, Node: Getting Started, Next: What is GNU Fortran?, Prev: Look and Feel, 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 don't already have `g77' installed on your system, you must see *Note Installation::. 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++; or Objective-C: (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 GNU CC 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'-specific 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.