1 \input texinfo @c -*-texinfo-*-
5 @set last-update 2000-11-27
6 @set copyrights-g77 1995,1996,1997,1998,1999,2000
10 @c This tells @include'd files that they're part of the overall G77 doc
11 @c set. (They might be part of a higher-level doc set too.)
14 @c @setfilename useg77.info
15 @c @setfilename portg77.info
16 @c To produce the full manual, use the "g77.info" setfilename, and
17 @c make sure the following do NOT begin with '@c' (and the @clear lines DO)
20 @c To produce a user-only manual, use the "useg77.info" setfilename, and
21 @c make sure the following does NOT begin with '@c':
23 @c To produce a porter-only manual, use the "portg77.info" setfilename,
24 @c and make sure the following does NOT begin with '@c':
27 @c 6/27/96 FSF DO wants smallbook fmt for 1st bound edition. (from gcc.texi)
30 @c i also commented out the finalout command, so if there *are* any
31 @c overfulls, you'll (hopefully) see the rectangle in the right hand
32 @c margin. -- burley 1999-03-13 (from mew's comment in gcc.texi).
37 @settitle Using and Porting GNU Fortran
40 @c seems reasonable to assume at least one of INTERNALS or USING is set...
42 @settitle Using GNU Fortran
45 @settitle Porting GNU Fortran
47 @c then again, have some fun
50 @settitle Doing Squat with GNU Fortran
58 @c Cause even numbered pages to be printed on the left hand side of
59 @c the page and odd numbered pages to be printed on the right hand
60 @c side of the page. Using this, you can print on both sides of a
61 @c sheet of paper and have the text on the same part of the sheet.
63 @c The text on right hand pages is pushed towards the right hand
64 @c margin and the text on left hand pages is pushed toward the left
66 @c (To provide the reverse effect, set bindingoffset to -0.75in.)
69 @c \global\bindingoffset=0.75in
70 @c \global\normaloffset =0.75in
74 @dircategory Programming
76 * g77: (g77). The GNU Fortran compiler.
80 This file documents the use and the internals of the GNU Fortran (@code{g77})
82 It corresponds to the @value{which-g77} version of @code{g77}.
86 This file documents the internals of the GNU Fortran (@code{g77}) compiler.
87 It corresponds to the @value{which-g77} version of @code{g77}.
90 This file documents the use of the GNU Fortran (@code{g77}) compiler.
91 It corresponds to the @value{which-g77} version of @code{g77}.
94 Published by the Free Software Foundation
95 59 Temple Place - Suite 330
96 Boston, MA 02111-1307 USA
98 Copyright (C) @value{copyrights-g77} Free Software Foundation, Inc.
100 Permission is granted to make and distribute verbatim copies of
101 this manual provided the copyright notice and this permission notice
102 are preserved on all copies.
105 Permission is granted to process this file through Tex and print the
106 results, provided the printed document carries copying permission
107 notice identical to this one except for the removal of this paragraph
108 (this paragraph not being relevant to the printed manual).
111 Permission is granted to copy and distribute modified versions of this
112 manual under the conditions for verbatim copying, provided also that the
113 sections entitled ``GNU General Public License,'' ``Funding for Free
114 Software,'' and ``Protect Your Freedom---Fight `Look And Feel'@w{}'' are
115 included exactly as in the original, and provided that the entire
116 resulting derived work is distributed under the terms of a permission
117 notice identical to this one.
119 Permission is granted to copy and distribute translations of this manual
120 into another language, under the above conditions for modified versions,
121 except that the sections entitled ``GNU General Public License,''
122 ``Funding for Free Software,'' and ``Protect Your Freedom---Fight `Look
123 And Feel'@w{}'', and this permission notice, may be included in
124 translations approved by the Free Software Foundation instead of in the
128 Contributed by James Craig Burley (@email{@value{email-burley}}).
129 Inspired by a first pass at translating @file{g77-0.5.16/f/DOC} that
130 was contributed to Craig by David Ronis (@email{ronis@@onsager.chem.mcgill.ca}).
132 @setchapternewpage odd
137 @center @titlefont{Using and Porting GNU Fortran}
142 @title Using GNU Fortran
145 @title Porting GNU Fortran
148 @center James Craig Burley
150 @center Last updated @value{last-update}
152 @center for version @value{version-g77}
154 @vskip 0pt plus 1filll
155 Copyright @copyright{} @value{copyrights-g77} Free Software Foundation, Inc.
157 For the @value{which-g77} Version*
159 Published by the Free Software Foundation @*
160 59 Temple Place - Suite 330@*
161 Boston, MA 02111-1307, USA@*
162 @c Last printed ??ber, 19??.@*
163 @c Printed copies are available for $? each.@*
166 Permission is granted to make and distribute verbatim copies of
167 this manual provided the copyright notice and this permission notice
168 are preserved on all copies.
170 Permission is granted to copy and distribute modified versions of this
171 manual under the conditions for verbatim copying, provided also that the
172 sections entitled ``GNU General Public License,'' ``Funding for Free
173 Software,'' and ``Protect Your Freedom---Fight `Look And Feel'@w{}'' are
174 included exactly as in the original, and provided that the entire
175 resulting derived work is distributed under the terms of a permission
176 notice identical to this one.
178 Permission is granted to copy and distribute translations of this manual
179 into another language, under the above conditions for modified versions,
180 except that the sections entitled ``GNU General Public License,''
181 ``Funding for Free Software,'' and ``Protect Your Freedom---Fight `Look
182 And Feel'@w{}'', and this permission notice, may be included in
183 translations approved by the Free Software Foundation instead of in the
190 @node Top, Copying,, (DIR)
196 This manual documents how to run, install and port @code{g77},
197 as well as its new features and incompatibilities,
198 and how to report bugs.
199 It corresponds to the @value{which-g77} version of @code{g77}.
204 This manual documents how to run and install @code{g77},
205 as well as its new features and incompatibilities, and how to report
207 It corresponds to the @value{which-g77} version of @code{g77}.
210 This manual documents how to port @code{g77},
211 as well as its new features and incompatibilities,
212 and how to report bugs.
213 It corresponds to the @value{which-g77} version of @code{g77}.
219 @emph{Warning:} This document is still under development,
220 and might not accurately reflect the @code{g77} code base
221 of which it is a part.
222 Efforts are made to keep it somewhat up-to-date,
223 but they are particularly concentrated
224 on any version of this information
225 that is distributed as part of a @emph{released} @code{g77}.
227 In particular, while this document is intended to apply to
228 the @value{which-g77} version of @code{g77},
229 only an official @emph{release} of that version
230 is expected to contain documentation that is
231 most consistent with the @code{g77} product in that version.
235 * Copying:: GNU General Public License says
236 how you can copy and share GNU Fortran.
237 * Contributors:: People who have contributed to GNU Fortran.
238 * Funding:: How to help assure continued work for free software.
239 * Funding GNU Fortran:: How to help assure continued work on GNU Fortran.
240 * Look and Feel:: Protect your freedom---fight ``look and feel''.
242 * Getting Started:: Finding your way around this manual.
243 * What is GNU Fortran?:: How @code{g77} fits into the universe.
244 * G77 and GCC:: You can compile Fortran, C, or other programs.
245 * Invoking G77:: Command options supported by @code{g77}.
246 * News:: News about recent releases of @code{g77}.
247 * Changes:: User-visible changes to recent releases of @code{g77}.
248 * Language:: The GNU Fortran language.
249 * Compiler:: The GNU Fortran compiler.
250 * Other Dialects:: Dialects of Fortran supported by @code{g77}.
251 * Other Compilers:: Fortran compilers other than @code{g77}.
252 * Other Languages:: Languages other than Fortran.
253 * Installation:: How to configure, compile and install GNU Fortran.
254 * Debugging and Interfacing:: How @code{g77} generates code.
255 * Collected Fortran Wisdom:: How to avoid Trouble.
256 * Trouble:: If you have trouble with GNU Fortran.
257 * Open Questions:: Things we'd like to know.
258 * Bugs:: How, why, and where to report bugs.
259 * Service:: How to find suppliers of support for GNU Fortran.
262 * Adding Options:: Guidance on teaching @code{g77} about new options.
263 * Projects:: Projects for @code{g77} internals hackers.
264 * Front End:: Design and implementation of the @code{g77} front end.
267 * M: Diagnostics. Diagnostics produced by @code{g77}.
269 * Index:: Index of concepts and symbol names.
271 @c yes, the "M: " @emph{is} intentional -- bad.def references it (CMPAMBIG)!
274 @unnumbered GNU GENERAL PUBLIC LICENSE
275 @center Version 2, June 1991
278 Copyright @copyright{} 1989, 1991 Free Software Foundation, Inc.
279 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
281 Everyone is permitted to copy and distribute verbatim copies
282 of this license document, but changing it is not allowed.
285 @unnumberedsec Preamble
287 The licenses for most software are designed to take away your
288 freedom to share and change it. By contrast, the GNU General Public
289 License is intended to guarantee your freedom to share and change free
290 software---to make sure the software is free for all its users. This
291 General Public License applies to most of the Free Software
292 Foundation's software and to any other program whose authors commit to
293 using it. (Some other Free Software Foundation software is covered by
294 the GNU Library General Public License instead.) You can apply it to
297 When we speak of free software, we are referring to freedom, not
298 price. Our General Public Licenses are designed to make sure that you
299 have the freedom to distribute copies of free software (and charge for
300 this service if you wish), that you receive source code or can get it
301 if you want it, that you can change the software or use pieces of it
302 in new free programs; and that you know you can do these things.
304 To protect your rights, we need to make restrictions that forbid
305 anyone to deny you these rights or to ask you to surrender the rights.
306 These restrictions translate to certain responsibilities for you if you
307 distribute copies of the software, or if you modify it.
309 For example, if you distribute copies of such a program, whether
310 gratis or for a fee, you must give the recipients all the rights that
311 you have. You must make sure that they, too, receive or can get the
312 source code. And you must show them these terms so they know their
315 We protect your rights with two steps: (1) copyright the software, and
316 (2) offer you this license which gives you legal permission to copy,
317 distribute and/or modify the software.
319 Also, for each author's protection and ours, we want to make certain
320 that everyone understands that there is no warranty for this free
321 software. If the software is modified by someone else and passed on, we
322 want its recipients to know that what they have is not the original, so
323 that any problems introduced by others will not reflect on the original
324 authors' reputations.
326 Finally, any free program is threatened constantly by software
327 patents. We wish to avoid the danger that redistributors of a free
328 program will individually obtain patent licenses, in effect making the
329 program proprietary. To prevent this, we have made it clear that any
330 patent must be licensed for everyone's free use or not licensed at all.
332 The precise terms and conditions for copying, distribution and
336 @unnumberedsec TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
339 @center TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
344 This License applies to any program or other work which contains
345 a notice placed by the copyright holder saying it may be distributed
346 under the terms of this General Public License. The ``Program'', below,
347 refers to any such program or work, and a ``work based on the Program''
348 means either the Program or any derivative work under copyright law:
349 that is to say, a work containing the Program or a portion of it,
350 either verbatim or with modifications and/or translated into another
351 language. (Hereinafter, translation is included without limitation in
352 the term ``modification''.) Each licensee is addressed as ``you''.
354 Activities other than copying, distribution and modification are not
355 covered by this License; they are outside its scope. The act of
356 running the Program is not restricted, and the output from the Program
357 is covered only if its contents constitute a work based on the
358 Program (independent of having been made by running the Program).
359 Whether that is true depends on what the Program does.
362 You may copy and distribute verbatim copies of the Program's
363 source code as you receive it, in any medium, provided that you
364 conspicuously and appropriately publish on each copy an appropriate
365 copyright notice and disclaimer of warranty; keep intact all the
366 notices that refer to this License and to the absence of any warranty;
367 and give any other recipients of the Program a copy of this License
368 along with the Program.
370 You may charge a fee for the physical act of transferring a copy, and
371 you may at your option offer warranty protection in exchange for a fee.
374 You may modify your copy or copies of the Program or any portion
375 of it, thus forming a work based on the Program, and copy and
376 distribute such modifications or work under the terms of Section 1
377 above, provided that you also meet all of these conditions:
381 You must cause the modified files to carry prominent notices
382 stating that you changed the files and the date of any change.
385 You must cause any work that you distribute or publish, that in
386 whole or in part contains or is derived from the Program or any
387 part thereof, to be licensed as a whole at no charge to all third
388 parties under the terms of this License.
391 If the modified program normally reads commands interactively
392 when run, you must cause it, when started running for such
393 interactive use in the most ordinary way, to print or display an
394 announcement including an appropriate copyright notice and a
395 notice that there is no warranty (or else, saying that you provide
396 a warranty) and that users may redistribute the program under
397 these conditions, and telling the user how to view a copy of this
398 License. (Exception: if the Program itself is interactive but
399 does not normally print such an announcement, your work based on
400 the Program is not required to print an announcement.)
403 These requirements apply to the modified work as a whole. If
404 identifiable sections of that work are not derived from the Program,
405 and can be reasonably considered independent and separate works in
406 themselves, then this License, and its terms, do not apply to those
407 sections when you distribute them as separate works. But when you
408 distribute the same sections as part of a whole which is a work based
409 on the Program, the distribution of the whole must be on the terms of
410 this License, whose permissions for other licensees extend to the
411 entire whole, and thus to each and every part regardless of who wrote it.
413 Thus, it is not the intent of this section to claim rights or contest
414 your rights to work written entirely by you; rather, the intent is to
415 exercise the right to control the distribution of derivative or
416 collective works based on the Program.
418 In addition, mere aggregation of another work not based on the Program
419 with the Program (or with a work based on the Program) on a volume of
420 a storage or distribution medium does not bring the other work under
421 the scope of this License.
424 You may copy and distribute the Program (or a work based on it,
425 under Section 2) in object code or executable form under the terms of
426 Sections 1 and 2 above provided that you also do one of the following:
430 Accompany it with the complete corresponding machine-readable
431 source code, which must be distributed under the terms of Sections
432 1 and 2 above on a medium customarily used for software interchange; or,
435 Accompany it with a written offer, valid for at least three
436 years, to give any third party, for a charge no more than your
437 cost of physically performing source distribution, a complete
438 machine-readable copy of the corresponding source code, to be
439 distributed under the terms of Sections 1 and 2 above on a medium
440 customarily used for software interchange; or,
443 Accompany it with the information you received as to the offer
444 to distribute corresponding source code. (This alternative is
445 allowed only for noncommercial distribution and only if you
446 received the program in object code or executable form with such
447 an offer, in accord with Subsection b above.)
450 The source code for a work means the preferred form of the work for
451 making modifications to it. For an executable work, complete source
452 code means all the source code for all modules it contains, plus any
453 associated interface definition files, plus the scripts used to
454 control compilation and installation of the executable. However, as a
455 special exception, the source code distributed need not include
456 anything that is normally distributed (in either source or binary
457 form) with the major components (compiler, kernel, and so on) of the
458 operating system on which the executable runs, unless that component
459 itself accompanies the executable.
461 If distribution of executable or object code is made by offering
462 access to copy from a designated place, then offering equivalent
463 access to copy the source code from the same place counts as
464 distribution of the source code, even though third parties are not
465 compelled to copy the source along with the object code.
468 You may not copy, modify, sublicense, or distribute the Program
469 except as expressly provided under this License. Any attempt
470 otherwise to copy, modify, sublicense or distribute the Program is
471 void, and will automatically terminate your rights under this License.
472 However, parties who have received copies, or rights, from you under
473 this License will not have their licenses terminated so long as such
474 parties remain in full compliance.
477 You are not required to accept this License, since you have not
478 signed it. However, nothing else grants you permission to modify or
479 distribute the Program or its derivative works. These actions are
480 prohibited by law if you do not accept this License. Therefore, by
481 modifying or distributing the Program (or any work based on the
482 Program), you indicate your acceptance of this License to do so, and
483 all its terms and conditions for copying, distributing or modifying
484 the Program or works based on it.
487 Each time you redistribute the Program (or any work based on the
488 Program), the recipient automatically receives a license from the
489 original licensor to copy, distribute or modify the Program subject to
490 these terms and conditions. You may not impose any further
491 restrictions on the recipients' exercise of the rights granted herein.
492 You are not responsible for enforcing compliance by third parties to
496 If, as a consequence of a court judgment or allegation of patent
497 infringement or for any other reason (not limited to patent issues),
498 conditions are imposed on you (whether by court order, agreement or
499 otherwise) that contradict the conditions of this License, they do not
500 excuse you from the conditions of this License. If you cannot
501 distribute so as to satisfy simultaneously your obligations under this
502 License and any other pertinent obligations, then as a consequence you
503 may not distribute the Program at all. For example, if a patent
504 license would not permit royalty-free redistribution of the Program by
505 all those who receive copies directly or indirectly through you, then
506 the only way you could satisfy both it and this License would be to
507 refrain entirely from distribution of the Program.
509 If any portion of this section is held invalid or unenforceable under
510 any particular circumstance, the balance of the section is intended to
511 apply and the section as a whole is intended to apply in other
514 It is not the purpose of this section to induce you to infringe any
515 patents or other property right claims or to contest validity of any
516 such claims; this section has the sole purpose of protecting the
517 integrity of the free software distribution system, which is
518 implemented by public license practices. Many people have made
519 generous contributions to the wide range of software distributed
520 through that system in reliance on consistent application of that
521 system; it is up to the author/donor to decide if he or she is willing
522 to distribute software through any other system and a licensee cannot
525 This section is intended to make thoroughly clear what is believed to
526 be a consequence of the rest of this License.
529 If the distribution and/or use of the Program is restricted in
530 certain countries either by patents or by copyrighted interfaces, the
531 original copyright holder who places the Program under this License
532 may add an explicit geographical distribution limitation excluding
533 those countries, so that distribution is permitted only in or among
534 countries not thus excluded. In such case, this License incorporates
535 the limitation as if written in the body of this License.
538 The Free Software Foundation may publish revised and/or new versions
539 of the General Public License from time to time. Such new versions will
540 be similar in spirit to the present version, but may differ in detail to
541 address new problems or concerns.
543 Each version is given a distinguishing version number. If the Program
544 specifies a version number of this License which applies to it and ``any
545 later version'', you have the option of following the terms and conditions
546 either of that version or of any later version published by the Free
547 Software Foundation. If the Program does not specify a version number of
548 this License, you may choose any version ever published by the Free Software
552 If you wish to incorporate parts of the Program into other free
553 programs whose distribution conditions are different, write to the author
554 to ask for permission. For software which is copyrighted by the Free
555 Software Foundation, write to the Free Software Foundation; we sometimes
556 make exceptions for this. Our decision will be guided by the two goals
557 of preserving the free status of all derivatives of our free software and
558 of promoting the sharing and reuse of software generally.
568 BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
569 FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
570 OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
571 PROVIDE THE PROGRAM ``AS IS'' WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
572 OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
573 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
574 TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
575 PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
576 REPAIR OR CORRECTION.
579 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
580 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
581 REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
582 INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
583 OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
584 TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
585 YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
586 PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
587 POSSIBILITY OF SUCH DAMAGES.
591 @heading END OF TERMS AND CONDITIONS
594 @center END OF TERMS AND CONDITIONS
598 @unnumberedsec How to Apply These Terms to Your New Programs
600 If you develop a new program, and you want it to be of the greatest
601 possible use to the public, the best way to achieve this is to make it
602 free software which everyone can redistribute and change under these terms.
604 To do so, attach the following notices to the program. It is safest
605 to attach them to the start of each source file to most effectively
606 convey the exclusion of warranty; and each file should have at least
607 the ``copyright'' line and a pointer to where the full notice is found.
610 @var{one line to give the program's name and a brief idea of what it does.}
611 Copyright (C) @var{year} @var{name of author}
613 This program is free software; you can redistribute it and/or modify
614 it under the terms of the GNU General Public License as published by
615 the Free Software Foundation; either version 2 of the License, or
616 (at your option) any later version.
618 This program is distributed in the hope that it will be useful,
619 but WITHOUT ANY WARRANTY; without even the implied warranty of
620 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
621 GNU General Public License for more details.
623 You should have received a copy of the GNU General Public License
624 along with this program; if not, write to the Free Software
625 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
628 Also add information on how to contact you by electronic and paper mail.
630 If the program is interactive, make it output a short notice like this
631 when it starts in an interactive mode:
634 Gnomovision version 69, Copyright (C) @var{year} @var{name of author}
635 Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
637 This is free software, and you are welcome to redistribute it
638 under certain conditions; type `show c' for details.
641 The hypothetical commands @samp{show w} and @samp{show c} should show
642 the appropriate parts of the General Public License. Of course, the
643 commands you use may be called something other than @samp{show w} and
644 @samp{show c}; they could even be mouse-clicks or menu items---whatever
647 You should also get your employer (if you work as a programmer) or your
648 school, if any, to sign a ``copyright disclaimer'' for the program, if
649 necessary. Here is a sample; alter the names:
652 Yoyodyne, Inc., hereby disclaims all copyright interest in the program
653 `Gnomovision' (which makes passes at compilers) written by James Hacker.
655 @var{signature of Ty Coon}, 1 April 1989
656 Ty Coon, President of Vice
659 This General Public License does not permit incorporating your program into
660 proprietary programs. If your program is a subroutine library, you may
661 consider it more useful to permit linking proprietary applications with the
662 library. If this is what you want to do, use the GNU Library General
663 Public License instead of this License.
666 @unnumbered Contributors to GNU Fortran
670 In addition to James Craig Burley, who wrote the front end,
671 many people have helped create and improve GNU Fortran.
675 The packaging and compiler portions of GNU Fortran are based largely
676 on the GNU CC compiler.
677 @xref{Contributors,,Contributors to GNU CC,gcc,Using and Porting GNU CC},
678 for more information.
681 The run-time library used by GNU Fortran is a repackaged version
682 of the @code{libf2c} library (combined from the @code{libF77} and
683 @code{libI77} libraries) provided as part of @code{f2c}, available for
684 free from @code{netlib} sites on the Internet.
687 Cygnus Support and The Free Software Foundation contributed
688 significant money and/or equipment to Craig's efforts.
691 The following individuals served as alpha testers prior to @code{g77}'s
692 public release. This work consisted of testing, researching, sometimes
693 debugging, and occasionally providing small amounts of code and fixes
694 for @code{g77}, plus offering plenty of helpful advice to Craig:
700 Dr.@: Mark Fernyhough
702 Takafumi Hayashi (The University of Aizu)---@email{takafumi@@u-aizu.ac.jp}
706 Michel Kern (INRIA and Rice University)---@email{Michel.Kern@@inria.fr}
708 Dr.@: A. O. V. Le Blanc
730 Scott Snyder (@email{snyder@@d0sgif.fnal.gov})
731 provided the patch to add rudimentary support
732 for @code{INTEGER*1}, @code{INTEGER*2}, and
734 This inspired Craig to add further support,
735 even though the resulting support
736 would still be incomplete, because version 0.6 is still
740 David Ronis (@email{ronis@@onsager.chem.mcgill.ca}) inspired
741 and encouraged Craig to rewrite the documentation in texinfo
742 format by contributing a first pass at a translation of the
743 old @file{g77-0.5.16/f/DOC} file.
746 Toon Moene (@email{toon@@moene.indiv.nluug.nl}) performed
747 some analysis of generated code as part of an overall project
748 to improve @code{g77} code generation to at least be as good
749 as @code{f2c} used in conjunction with @code{gcc}.
750 So far, this has resulted in the three, somewhat
751 experimental, options added by @code{g77} to the @code{gcc}
752 compiler and its back end.
754 (These, in turn, had made their way into the @code{egcs}
755 version of the compiler, and do not exist in @code{gcc}
756 version 2.8 or versions of @code{g77} based on that version
760 John Carr (@email{jfc@@mit.edu}) wrote the alias analysis improvements.
763 Thanks to Mary Cortani and the staff at Craftwork Solutions
764 (@email{support@@craftwork.com}) for all of their support.
767 Many other individuals have helped debug, test, and improve @code{g77}
768 over the past several years, and undoubtedly more people
769 will be doing so in the future.
770 If you have done so, and would like
771 to see your name listed in the above list, please ask!
772 The default is that people wish to remain anonymous.
776 @chapter Funding Free Software
778 If you want to have more free software a few years from now, it makes
779 sense for you to help encourage people to contribute funds for its
780 development. The most effective approach known is to encourage
781 commercial redistributors to donate.
783 Users of free software systems can boost the pace of development by
784 encouraging for-a-fee distributors to donate part of their selling price
785 to free software developers---the Free Software Foundation, and others.
787 The way to convince distributors to do this is to demand it and expect
788 it from them. So when you compare distributors, judge them partly by
789 how much they give to free software development. Show distributors
790 they must compete to be the one who gives the most.
792 To make this approach work, you must insist on numbers that you can
793 compare, such as, ``We will donate ten dollars to the Frobnitz project
794 for each disk sold.'' Don't be satisfied with a vague promise, such as
795 ``A portion of the profits are donated,'' since it doesn't give a basis
798 Even a precise fraction ``of the profits from this disk'' is not very
799 meaningful, since creative accounting and unrelated business decisions
800 can greatly alter what fraction of the sales price counts as profit.
801 If the price you pay is $50, ten percent of the profit is probably
802 less than a dollar; it might be a few cents, or nothing at all.
804 Some redistributors do development work themselves. This is useful too;
805 but to keep everyone honest, you need to inquire how much they do, and
806 what kind. Some kinds of development make much more long-term
807 difference than others. For example, maintaining a separate version of
808 a program contributes very little; maintaining the standard version of a
809 program for the whole community contributes much. Easy new ports
810 contribute little, since someone else would surely do them; difficult
811 ports such as adding a new CPU to the GNU C compiler contribute more;
812 major new features or packages contribute the most.
814 By establishing the idea that supporting further development is ``the
815 proper thing to do'' when distributing free software for a fee, we can
816 assure a steady flow of resources into making more free software.
819 Copyright (C) 1994 Free Software Foundation, Inc.
820 Verbatim copying and redistribution of this section is permitted
821 without royalty; alteration is not permitted.
824 @node Funding GNU Fortran
825 @chapter Funding GNU Fortran
826 @cindex funding improvements
827 @cindex improvements, funding
829 Work on GNU Fortran is still being done mostly by its author,
830 James Craig Burley (@email{@value{email-burley}}), who is a volunteer
831 for, not an employee of, the Free Software Foundation (FSF).
832 (He has a web page at @uref{@value{www-burley}}.)
834 As with other GNU software, funding is important because it can pay for
835 needed equipment, personnel, and so on.
837 @cindex FSF, funding the
838 @cindex funding the FSF
839 The FSF provides information on the best way to fund ongoing
840 development of GNU software (such as GNU Fortran) in documents
841 such as the ``GNUS Bulletin''.
842 Email @email{gnu@@gnu.org} for information on funding the FSF.
844 To fund specific GNU Fortran work in particular, the FSF might
845 provide a means for that, but the FSF does not provide direct funding
846 to the author of GNU Fortran to continue his work. The FSF has
847 employee salary restrictions that can be incompatible with the
848 financial needs of some volunteers, who therefore choose to
849 remain volunteers and thus be able to be free to do contract work
850 and otherwise make their own schedules for doing GNU work.
852 Still, funding the FSF at least indirectly benefits work
853 on specific projects like GNU Fortran because it ensures the
854 continuing operation of the FSF offices, their workstations, their
855 network connections, and so on, which are invaluable to volunteers.
856 (Similarly, hiring Cygnus Support can help a project like GNU
857 Fortran---Cygnus has been a long-time donor of equipment usage to the author
858 of GNU Fortran, and this too has been invaluable---see @ref{Contributors}.)
860 Currently, the only way to directly fund the author of GNU Fortran
861 in his work on that project is to hire him for the work you want
862 him to do, or donate money to him.
863 Several people have done this
864 already, with the result that he has not needed to immediately find
865 contract work on a few occasions.
866 If more people did this, he
867 would be able to plan on not doing contract work for many months and
868 could thus devote that time to work on projects (such as the planned
869 changes for 0.6) that require longer timeframes to complete.
870 For the latest information on the status of the author, do
871 @kbd{finger -l burley@@gnu.org} on a UNIX system
872 (or any system with a command like UNIX @code{finger}).
874 Another important way to support work on GNU Fortran is to volunteer
876 Work is needed on documentation, testing, porting
877 to various machines, and in some cases, coding (although major
878 changes planned for version 0.6 make it difficult to add manpower to this
880 Email @email{@value{email-general}} to volunteer for this work.
882 @xref{Funding,,Funding Free Software}, for more information.
885 @chapter Protect Your Freedom---Fight ``Look And Feel''
886 @c the above chapter heading overflows onto the next line. --mew 1/26/93
888 To preserve the ability to write free software, including replacements
889 for proprietary software, authors must be free to replicate the
890 user interface to which users of existing software have become
893 @xref{Look and Feel,,Protect Your Freedom---Fight ``Look And Feel'',
894 gcc,Using and Porting GNU CC}, for more information.
896 @node Getting Started
897 @chapter Getting Started
898 @cindex getting started
903 If you don't need help getting started reading the portions
904 of this manual that are most important to you, you should skip
905 this portion of the manual.
907 If you are new to compilers, especially Fortran compilers, or
908 new to how compilers are structured under UNIX and UNIX-like
909 systems, you'll want to see @ref{What is GNU Fortran?}.
911 If you are new to GNU compilers, or have used only one GNU
912 compiler in the past and not had to delve into how it lets
913 you manage various versions and configurations of @code{gcc},
914 you should see @ref{G77 and GCC}.
916 Everyone except experienced @code{g77} users should
917 see @ref{Invoking G77}.
919 If you're acquainted with previous versions of @code{g77},
920 you should see @ref{News,,News About GNU Fortran}.
921 Further, if you've actually used previous versions of @code{g77},
922 especially if you've written or modified Fortran code to
923 be compiled by previous versions of @code{g77}, you
924 should see @ref{Changes}.
926 If you intend to write or otherwise compile code that is
927 not already strictly conforming ANSI FORTRAN 77---and this
928 is probably everyone---you should see @ref{Language}.
930 If you don't already have @code{g77} installed on your
931 system, you must see @ref{Installation}.
933 If you run into trouble getting Fortran code to compile,
934 link, run, or work properly, you might find answers
935 if you see @ref{Debugging and Interfacing},
936 see @ref{Collected Fortran Wisdom},
937 and see @ref{Trouble}.
938 You might also find that the problems you are encountering
939 are bugs in @code{g77}---see @ref{Bugs}, for information on
940 reporting them, after reading the other material.
942 If you need further help with @code{g77}, or with
943 freely redistributable software in general,
946 If you would like to help the @code{g77} project,
947 see @ref{Funding GNU Fortran}, for information on
948 helping financially, and see @ref{Projects}, for information
949 on helping in other ways.
951 If you're generally curious about the future of
952 @code{g77}, see @ref{Projects}.
953 If you're curious about its past,
954 see @ref{Contributors},
955 and see @ref{Funding GNU Fortran}.
957 To see a few of the questions maintainers of @code{g77} have,
958 and that you might be able to answer,
959 see @ref{Open Questions}.
962 @node What is GNU Fortran?
963 @chapter What is GNU Fortran?
964 @cindex concepts, basic
965 @cindex basic concepts
967 GNU Fortran, or @code{g77}, is designed initially as a free replacement
968 for, or alternative to, the UNIX @code{f77} command.
969 (Similarly, @code{gcc} is designed as a replacement
970 for the UNIX @code{cc} command.)
972 @code{g77} also is designed to fit in well with the other
973 fine GNU compilers and tools.
975 Sometimes these design goals conflict---in such cases, resolution
976 often is made in favor of fitting in well with Project GNU.
977 These cases are usually identified in the appropriate
978 sections of this manual.
981 As compilers, @code{g77}, @code{gcc}, and @code{f77}
982 share the following characteristics:
990 They read a user's program, stored in a file and
991 containing instructions written in the appropriate
992 language (Fortran, C, and so on).
993 This file contains @dfn{source code}.
995 @cindex translation of user programs
997 @cindex code, machine
1000 They translate the user's program into instructions
1001 a computer can carry out more quickly than it takes
1002 to translate the instructions in the first place.
1003 These instructions are called @dfn{machine code}---code
1004 designed to be efficiently translated and processed
1005 by a machine such as a computer.
1006 Humans usually aren't as good writing machine code
1007 as they are at writing Fortran or C, because
1008 it is easy to make tiny mistakes writing machine code.
1009 When writing Fortran or C, it is easy
1010 to make big mistakes.
1013 @cindex bugs, finding
1014 @cindex @code{gdb}, command
1015 @cindex commands, @code{gdb}
1017 They provide information in the generated machine code
1018 that can make it easier to find bugs in the program
1019 (using a debugging tool, called a @dfn{debugger},
1020 such as @code{gdb}).
1024 @cindex @code{ld} command
1025 @cindex commands, @code{ld}
1027 They locate and gather machine code already generated
1028 to perform actions requested by statements in
1030 This machine code is organized
1031 into @dfn{libraries} and is located and gathered
1032 during the @dfn{link} phase of the compilation
1034 (Linking often is thought of as a separate
1035 step, because it can be directly invoked via the
1037 However, the @code{g77} and @code{gcc}
1038 commands, as with most compiler commands, automatically
1039 perform the linking step by calling on @code{ld}
1040 directly, unless asked to not do so by the user.)
1042 @cindex language, incorrect use of
1043 @cindex incorrect use of language
1045 They attempt to diagnose cases where the user's
1046 program contains incorrect usages of the language.
1047 The @dfn{diagnostics} produced by the compiler
1048 indicate the problem and the location in the user's
1049 source file where the problem was first noticed.
1050 The user can use this information to locate and
1052 @cindex diagnostics, incorrect
1053 @cindex incorrect diagnostics
1054 @cindex error messages, incorrect
1055 @cindex incorrect error messages
1056 (Sometimes an incorrect usage
1057 of the language leads to a situation where the
1058 compiler can no longer make any sense of what
1059 follows---while a human might be able to---and
1060 thus ends up complaining about many ``problems''
1061 it encounters that, in fact, stem from just one
1062 problem, usually the first one reported.)
1065 @cindex questionable instructions
1067 They attempt to diagnose cases where the user's
1068 program contains a correct usage of the language,
1069 but instructs the computer to do something questionable.
1070 These diagnostics often are in the form of @dfn{warnings},
1071 instead of the @dfn{errors} that indicate incorrect
1072 usage of the language.
1075 How these actions are performed is generally under the
1076 control of the user.
1077 Using command-line options, the user can specify
1078 how persnickety the compiler is to be regarding
1079 the program (whether to diagnose questionable usage
1080 of the language), how much time to spend making
1081 the generated machine code run faster, and so on.
1083 @cindex components of g77
1084 @cindex @code{g77}, components of
1085 @code{g77} consists of several components:
1087 @cindex @code{gcc}, command
1088 @cindex commands, @code{gcc}
1091 A modified version of the @code{gcc} command, which also might be
1092 installed as the system's @code{cc} command.
1093 (In many cases, @code{cc} refers to the
1094 system's ``native'' C compiler, which
1095 might be a non-GNU compiler, or an older version
1096 of @code{gcc} considered more stable or that is
1097 used to build the operating system kernel.)
1099 @cindex @code{g77}, command
1100 @cindex commands, @code{g77}
1102 The @code{g77} command itself, which also might be installed as the
1103 system's @code{f77} command.
1105 @cindex libg2c library
1106 @cindex libf2c library
1107 @cindex libraries, libf2c
1108 @cindex libraries, libg2c
1109 @cindex run-time, library
1111 The @code{libg2c} run-time library.
1112 This library contains the machine code needed to support
1113 capabilities of the Fortran language that are not directly
1114 provided by the machine code generated by the @code{g77}
1117 @code{libg2c} is just the unique name @code{g77} gives
1118 to its version of @code{libf2c} to distinguish it from
1119 any copy of @code{libf2c} installed from @code{f2c}
1120 (or versions of @code{g77} that built @code{libf2c} under
1124 The maintainer of @code{libf2c} currently is
1125 @email{dmg@@bell-labs.com}.
1127 @cindex @code{f771}, program
1128 @cindex programs, @code{f771}
1130 @cindex @code{as} command
1131 @cindex commands, @code{as}
1132 @cindex assembly code
1133 @cindex code, assembly
1135 The compiler itself, internally named @code{f771}.
1137 Note that @code{f771} does not generate machine code directly---it
1138 generates @dfn{assembly code} that is a more readable form
1139 of machine code, leaving the conversion to actual machine code
1140 to an @dfn{assembler}, usually named @code{as}.
1143 @code{gcc} is often thought of as ``the C compiler'' only,
1144 but it does more than that.
1145 Based on command-line options and the names given for files
1146 on the command line, @code{gcc} determines which actions to perform, including
1147 preprocessing, compiling (in a variety of possible languages), assembling,
1150 @cindex driver, gcc command as
1151 @cindex @code{gcc}, command as driver
1152 @cindex executable file
1153 @cindex files, executable
1155 @cindex programs, cc1
1156 @cindex preprocessor
1158 @cindex programs, cpp
1159 For example, the command @samp{gcc foo.c} @dfn{drives} the file
1160 @file{foo.c} through the preprocessor @code{cpp}, then
1161 the C compiler (internally named
1162 @code{cc1}), then the assembler (usually @code{as}), then the linker
1163 (@code{ld}), producing an executable program named @file{a.out} (on
1166 @cindex cc1plus program
1167 @cindex programs, cc1plus
1168 As another example, the command @samp{gcc foo.cc} would do much the same as
1169 @samp{gcc foo.c}, but instead of using the C compiler named @code{cc1},
1170 @code{gcc} would use the C++ compiler (named @code{cc1plus}).
1172 @cindex @code{f771}, program
1173 @cindex programs, @code{f771}
1174 In a GNU Fortran installation, @code{gcc} recognizes Fortran source
1175 files by name just like it does C and C++ source files.
1176 It knows to use the Fortran compiler named @code{f771}, instead of
1177 @code{cc1} or @code{cc1plus}, to compile Fortran files.
1179 @cindex @code{gcc}, not recognizing Fortran source
1180 @cindex unrecognized file format
1181 @cindex file format not recognized
1182 Non-Fortran-related operation of @code{gcc} is generally
1183 unaffected by installing the GNU Fortran version of @code{gcc}.
1184 However, without the installed version of @code{gcc} being the
1185 GNU Fortran version, @code{gcc} will not be able to compile
1186 and link Fortran programs---and since @code{g77} uses @code{gcc}
1187 to do most of the actual work, neither will @code{g77}!
1189 @cindex @code{g77}, command
1190 @cindex commands, @code{g77}
1191 The @code{g77} command is essentially just a front-end for
1192 the @code{gcc} command.
1193 Fortran users will normally use @code{g77} instead of @code{gcc},
1195 knows how to specify the libraries needed to link with Fortran programs
1196 (@code{libg2c} and @code{lm}).
1197 @code{g77} can still compile and link programs and
1198 source files written in other languages, just like @code{gcc}.
1200 @cindex printing version information
1201 @cindex version information, printing
1202 The command @samp{g77 -v} is a quick
1203 way to display lots of version information for the various programs
1204 used to compile a typical preprocessed Fortran source file---this
1205 produces much more output than @samp{gcc -v} currently does.
1206 (If it produces an error message near the end of the output---diagnostics
1207 from the linker, usually @code{ld}---you might
1208 have an out-of-date @code{libf2c} that improperly handles
1209 complex arithmetic.)
1210 In the output of this command, the line beginning @samp{GNU Fortran Front
1211 End} identifies the version number of GNU Fortran; immediately
1212 preceding that line is a line identifying the version of @code{gcc}
1213 with which that version of @code{g77} was built.
1215 @cindex libf2c library
1216 @cindex libraries, libf2c
1217 The @code{libf2c} library is distributed with GNU Fortran for
1218 the convenience of its users, but is not part of GNU Fortran.
1219 It contains the procedures
1220 needed by Fortran programs while they are running.
1222 @cindex in-line code
1223 @cindex code, in-line
1224 For example, while code generated by @code{g77} is likely
1225 to do additions, subtractions, and multiplications @dfn{in line}---in
1226 the actual compiled code---it is not likely to do trigonometric
1229 Instead, operations like trigonometric
1230 functions are compiled by the @code{f771} compiler
1231 (invoked by @code{g77} when compiling Fortran code) into machine
1232 code that, when run, calls on functions in @code{libg2c}, so
1233 @code{libg2c} must be linked with almost every useful program
1234 having any component compiled by GNU Fortran.
1235 (As mentioned above, the @code{g77} command takes
1236 care of all this for you.)
1238 The @code{f771} program represents most of what is unique to GNU Fortran.
1239 While much of the @code{libg2c} component comes from
1240 the @code{libf2c} component of @code{f2c},
1241 a free Fortran-to-C converter distributed by Bellcore (AT&T),
1242 plus @code{libU77}, provided by Dave Love,
1243 and the @code{g77} command is just a small front-end to @code{gcc},
1244 @code{f771} is a combination of two rather
1245 large chunks of code.
1247 @cindex GNU Back End (GBE)
1249 @cindex @code{gcc}, back end
1250 @cindex back end, gcc
1251 @cindex code generator
1252 One chunk is the so-called @dfn{GNU Back End}, or GBE,
1253 which knows how to generate fast code for a wide variety of processors.
1254 The same GBE is used by the C, C++, and Fortran compiler programs @code{cc1},
1255 @code{cc1plus}, and @code{f771}, plus others.
1256 Often the GBE is referred to as the ``gcc back end'' or
1257 even just ``gcc''---in this manual, the term GBE is used
1258 whenever the distinction is important.
1260 @cindex GNU Fortran Front End (FFE)
1262 @cindex @code{g77}, front end
1263 @cindex front end, @code{g77}
1264 The other chunk of @code{f771} is the
1265 majority of what is unique about GNU Fortran---the code that knows how
1266 to interpret Fortran programs to determine what they are intending to
1267 do, and then communicate that knowledge to the GBE for actual compilation
1269 This chunk is called the @dfn{Fortran Front End} (FFE).
1270 The @code{cc1} and @code{cc1plus} programs have their own front ends,
1271 for the C and C++ languages, respectively.
1272 These fronts ends are responsible for diagnosing
1273 incorrect usage of their respective languages by the
1274 programs the process, and are responsible for most of
1275 the warnings about questionable constructs as well.
1276 (The GBE handles producing some warnings, like those
1277 concerning possible references to undefined variables.)
1279 Because so much is shared among the compilers for various languages,
1280 much of the behavior and many of the user-selectable options for these
1281 compilers are similar.
1282 For example, diagnostics (error messages and
1283 warnings) are similar in appearance; command-line
1284 options like @samp{-Wall} have generally similar effects; and the quality
1285 of generated code (in terms of speed and size) is roughly similar
1286 (since that work is done by the shared GBE).
1289 @chapter Compile Fortran, C, or Other Programs
1290 @cindex compiling programs
1291 @cindex programs, compiling
1293 @cindex @code{gcc}, command
1294 @cindex commands, @code{gcc}
1295 A GNU Fortran installation includes a modified version of the @code{gcc}
1298 In a non-Fortran installation, @code{gcc} recognizes C, C++,
1299 and Objective-C source files.
1301 In a GNU Fortran installation, @code{gcc} also recognizes Fortran source
1302 files and accepts Fortran-specific command-line options, plus some
1303 command-line options that are designed to cater to Fortran users
1304 but apply to other languages as well.
1306 @xref{G++ and GCC,,Compile C; C++; or Objective-C,gcc,Using and Porting GNU CC},
1307 for information on the way different languages are handled
1308 by the GNU CC compiler (@code{gcc}).
1310 @cindex @code{g77}, command
1311 @cindex commands, @code{g77}
1312 Also provided as part of GNU Fortran is the @code{g77} command.
1313 The @code{g77} command is designed to make compiling and linking Fortran
1314 programs somewhat easier than when using the @code{gcc} command for
1316 It does this by analyzing the command line somewhat and changing it
1317 appropriately before submitting it to the @code{gcc} command.
1320 @cindex @code{g77} options, -v
1322 Use the @samp{-v} option with @code{g77}
1323 to see what is going on---the first line of output is the invocation
1324 of the @code{gcc} command.
1327 @chapter GNU Fortran Command Options
1328 @cindex GNU Fortran command options
1329 @cindex command options
1330 @cindex options, GNU Fortran command
1332 The @code{g77} command supports all the options supported by the
1334 @xref{Invoking GCC,,GNU CC Command Options,gcc,Using and Porting GNU CC},
1336 on the non-Fortran-specific aspects of the @code{gcc} command (and,
1337 therefore, the @code{g77} command).
1339 @cindex options, negative forms
1340 @cindex negative forms of options
1341 All @code{gcc} and @code{g77} options
1342 are accepted both by @code{g77} and by @code{gcc}
1343 (as well as any other drivers built at the same time,
1344 such as @code{g++}),
1345 since adding @code{g77} to the @code{gcc} distribution
1346 enables acceptance of @code{g77}-specific options
1347 by all of the relevant drivers.
1349 In some cases, options have positive and negative forms;
1350 the negative form of @samp{-ffoo} would be @samp{-fno-foo}.
1351 This manual documents only one of these two forms, whichever
1352 one is not the default.
1355 * Option Summary:: Brief list of all @code{g77} options,
1356 without explanations.
1357 * Overall Options:: Controlling the kind of output:
1358 an executable, object files, assembler files,
1359 or preprocessed source.
1360 * Shorthand Options:: Options that are shorthand for other options.
1361 * Fortran Dialect Options:: Controlling the variant of Fortran language
1363 * Warning Options:: How picky should the compiler be?
1364 * Debugging Options:: Symbol tables, measurements, and debugging dumps.
1365 * Optimize Options:: How much optimization?
1366 * Preprocessor Options:: Controlling header files and macro definitions.
1367 Also, getting dependency information for Make.
1368 * Directory Options:: Where to find header files and libraries.
1369 Where to find the compiler executable files.
1370 * Code Gen Options:: Specifying conventions for function calls, data layout
1372 * Environment Variables:: Env vars that affect GNU Fortran.
1375 @node Option Summary
1376 @section Option Summary
1378 Here is a summary of all the options specific to GNU Fortran, grouped
1379 by type. Explanations are in the following sections.
1382 @item Overall Options
1383 @xref{Overall Options,,Options Controlling the Kind of Output}.
1385 -fversion -fset-g77-defaults -fno-silent
1388 @item Shorthand Options
1389 @xref{Shorthand Options}.
1391 -ff66 -fno-f66 -ff77 -fno-f77 -fno-ugly
1394 @item Fortran Language Options
1395 @xref{Fortran Dialect Options,,Options Controlling Fortran Dialect}.
1397 -ffree-form -fno-fixed-form -ff90
1398 -fvxt -fdollar-ok -fno-backslash
1399 -fno-ugly-args -fno-ugly-assign -fno-ugly-assumed
1400 -fugly-comma -fugly-complex -fugly-init -fugly-logint
1401 -fonetrip -ftypeless-boz
1402 -fintrin-case-initcap -fintrin-case-upper
1403 -fintrin-case-lower -fintrin-case-any
1404 -fmatch-case-initcap -fmatch-case-upper
1405 -fmatch-case-lower -fmatch-case-any
1406 -fsource-case-upper -fsource-case-lower -fsource-case-preserve
1407 -fsymbol-case-initcap -fsymbol-case-upper
1408 -fsymbol-case-lower -fsymbol-case-any
1409 -fcase-strict-upper -fcase-strict-lower
1410 -fcase-initcap -fcase-upper -fcase-lower -fcase-preserve
1411 -ff2c-intrinsics-delete -ff2c-intrinsics-hide
1412 -ff2c-intrinsics-disable -ff2c-intrinsics-enable
1413 -fbadu77-intrinsics-delete -fbadu77-intrinsics-hide
1414 -fbadu77-intrinsics-disable -fbadu77-intrinsics-enable
1415 -ff90-intrinsics-delete -ff90-intrinsics-hide
1416 -ff90-intrinsics-disable -ff90-intrinsics-enable
1417 -fgnu-intrinsics-delete -fgnu-intrinsics-hide
1418 -fgnu-intrinsics-disable -fgnu-intrinsics-enable
1419 -fmil-intrinsics-delete -fmil-intrinsics-hide
1420 -fmil-intrinsics-disable -fmil-intrinsics-enable
1421 -funix-intrinsics-delete -funix-intrinsics-hide
1422 -funix-intrinsics-disable -funix-intrinsics-enable
1423 -fvxt-intrinsics-delete -fvxt-intrinsics-hide
1424 -fvxt-intrinsics-disable -fvxt-intrinsics-enable
1425 -ffixed-line-length-@var{n} -ffixed-line-length-none
1428 @item Warning Options
1429 @xref{Warning Options,,Options to Request or Suppress Warnings}.
1431 -fsyntax-only -pedantic -pedantic-errors -fpedantic
1432 -w -Wno-globals -Wimplicit -Wunused -Wuninitialized
1437 @item Debugging Options
1438 @xref{Debugging Options,,Options for Debugging Your Program or GCC}.
1443 @item Optimization Options
1444 @xref{Optimize Options,,Options that Control Optimization}.
1447 -ffloat-store -fforce-mem -fforce-addr -fno-inline
1448 -ffast-math -fstrength-reduce -frerun-cse-after-loop
1449 -fexpensive-optimizations -fdelayed-branch
1450 -fschedule-insns -fschedule-insn2 -fcaller-saves
1451 -funroll-loops -funroll-all-loops
1452 -fno-move-all-movables -fno-reduce-all-givs
1456 @item Directory Options
1457 @xref{Directory Options,,Options for Directory Search}.
1462 @item Code Generation Options
1463 @xref{Code Gen Options,,Options for Code Generation Conventions}.
1465 -fno-automatic -finit-local-zero -fno-f2c
1466 -ff2c-library -fno-underscoring -fno-ident
1467 -fpcc-struct-return -freg-struct-return
1468 -fshort-double -fno-common -fpack-struct
1469 -fzeros -fno-second-underscore
1470 -fdebug-kludge -femulate-complex
1471 -falias-check -fargument-alias
1472 -fargument-noalias -fno-argument-noalias-global
1473 -fno-globals -fflatten-arrays
1474 -fbounds-check -ffortran-bounds-check
1479 * Overall Options:: Controlling the kind of output:
1480 an executable, object files, assembler files,
1481 or preprocessed source.
1482 * Shorthand Options:: Options that are shorthand for other options.
1483 * Fortran Dialect Options:: Controlling the variant of Fortran language
1485 * Warning Options:: How picky should the compiler be?
1486 * Debugging Options:: Symbol tables, measurements, and debugging dumps.
1487 * Optimize Options:: How much optimization?
1488 * Preprocessor Options:: Controlling header files and macro definitions.
1489 Also, getting dependency information for Make.
1490 * Directory Options:: Where to find header files and libraries.
1491 Where to find the compiler executable files.
1492 * Code Gen Options:: Specifying conventions for function calls, data layout
1496 @node Overall Options
1497 @section Options Controlling the Kind of Output
1498 @cindex overall options
1499 @cindex options, overall
1501 Compilation can involve as many as four stages: preprocessing, code
1502 generation (often what is really meant by the term ``compilation''),
1503 assembly, and linking, always in that order. The first three
1504 stages apply to an individual source file, and end by producing an
1505 object file; linking combines all the object files (those newly
1506 compiled, and those specified as input) into an executable file.
1508 @cindex file name suffix
1509 @cindex suffixes, file name
1510 @cindex file name extension
1511 @cindex extensions, file name
1514 For any given input file, the file name suffix determines what kind of
1515 program is contained in the file---that is, the language in which the
1516 program is written is generally indicated by the suffix.
1517 Suffixes specific to GNU Fortran are listed below.
1518 @xref{Overall Options,,gcc,Using and Porting GNU CC}, for
1519 information on suffixes recognized by GNU CC.
1522 @cindex .f filename suffix
1523 @cindex .for filename suffix
1524 @cindex .FOR filename suffix
1526 @item @var{file}.for
1527 @item @var{file}.FOR
1528 Fortran source code that should not be preprocessed.
1530 Such source code cannot contain any preprocessor directives, such
1531 as @code{#include}, @code{#define}, @code{#if}, and so on.
1533 You can force @samp{.f} files to be preprocessed by @code{cpp} by using
1534 @samp{-x f77-cpp-input}.
1537 @cindex preprocessor
1538 @cindex C preprocessor
1539 @cindex cpp preprocessor
1540 @cindex Fortran preprocessor
1542 @cindex programs, cpp
1543 @cindex .F filename suffix
1544 @cindex .fpp filename suffix
1545 @cindex .FPP filename suffix
1547 @item @var{file}.fpp
1548 @item @var{file}.FPP
1549 Fortran source code that must be preprocessed (by the C preprocessor
1550 @code{cpp}, which is part of GNU CC).
1552 Note that preprocessing is not extended to the contents of
1553 files included by the @code{INCLUDE} directive---the @code{#include}
1554 preprocessor directive must be used instead.
1556 @cindex Ratfor preprocessor
1557 @cindex programs, @code{ratfor}
1558 @cindex @samp{.r} filename suffix
1559 @cindex @code{ratfor}
1561 Ratfor source code, which must be preprocessed by the @code{ratfor}
1562 command, which is available separately (as it is not yet part of the GNU
1563 Fortran distribution).
1564 One version in Fortran, adapted for use with @code{g77}, is at
1565 @uref{ftp://members.aol.com/n8tm/rat7.uue} (of uncertain copyright
1566 status). Another, public domain version in C is at
1567 @uref{http://sepwww.stanford.edu/sep/prof/ratfor.shar.2}.
1570 UNIX users typically use the @file{@var{file}.f} and @file{@var{file}.F}
1572 Users of other operating systems, especially those that cannot
1573 distinguish upper-case
1574 letters from lower-case letters in their file names, typically use
1575 the @file{@var{file}.for} and @file{@var{file}.fpp} nomenclature.
1580 Use of the preprocessor @code{cpp} allows use of C-like
1581 constructs such as @code{#define} and @code{#include}, but can
1582 lead to unexpected, even mistaken, results due to Fortran's source file
1584 It is recommended that use of the C preprocessor
1585 be limited to @code{#include} and, in
1586 conjunction with @code{#define}, only @code{#if} and related directives,
1587 thus avoiding in-line macro expansion entirely.
1588 This recommendation applies especially
1589 when using the traditional fixed source form.
1590 With free source form,
1591 fewer unexpected transformations are likely to happen, but use of
1592 constructs such as Hollerith and character constants can nevertheless
1593 present problems, especially when these are continued across multiple
1595 These problems result, primarily, from differences between the way
1596 such constants are interpreted by the C preprocessor and by a Fortran
1599 Another example of a problem that results from using the C preprocessor
1600 is that a Fortran comment line that happens to contain any
1601 characters ``interesting'' to the C preprocessor,
1602 such as a backslash at the end of the line,
1603 is not recognized by the preprocessor as a comment line,
1604 so instead of being passed through ``raw'',
1605 the line is edited according to the rules for the preprocessor.
1606 For example, the backslash at the end of the line is removed,
1607 along with the subsequent newline, resulting in the next
1608 line being effectively commented out---unfortunate if that
1609 line is a non-comment line of important code!
1611 @emph{Note:} The @samp{-traditional} and @samp{-undef} flags are supplied
1612 to @code{cpp} by default, to help avoid unpleasant surprises.
1613 @xref{Preprocessor Options,,Options Controlling the Preprocessor,
1614 gcc,Using and Porting GNU CC}.
1615 This means that ANSI C preprocessor features (such as the @samp{#}
1616 operator) aren't available, and only variables in the C reserved
1617 namespace (generally, names with a leading underscore) are liable to
1618 substitution by C predefines.
1619 Thus, if you want to do system-specific
1620 tests, use, for example, @samp{#ifdef __linux__} rather than @samp{#ifdef linux}.
1621 Use the @samp{-v} option to see exactly how the preprocessor is invoked.
1624 Unfortunately, the @samp{-traditional} flag will not avoid an error from
1625 anything that @code{cpp} sees as an unterminated C comment, such as:
1627 C Some Fortran compilers accept /* as starting
1628 C an inline comment.
1630 @xref{Trailing Comment}.
1632 The following options that affect overall processing are recognized
1633 by the @code{g77} and @code{gcc} commands in a GNU Fortran installation:
1636 @cindex -fversion option
1637 @cindex options, -fversion
1638 @cindex printing version information
1639 @cindex version information, printing
1640 @cindex consistency checks
1641 @cindex internal consistency checks
1642 @cindex checks, of internal consistency
1644 Ensure that the @code{g77}-specific version of the compiler phase is reported,
1646 and, starting in @code{egcs} version 1.1,
1647 that internal consistency checks in the @file{f771} program are run.
1649 This option is supplied automatically when @samp{-v} or @samp{--verbose}
1650 is specified as a command-line option for @code{g77} or @code{gcc}
1651 and when the resulting commands compile Fortran source files.
1653 @cindex -fset-g77-defaults option
1654 @cindex options, -fset-g77-defaults
1655 @item -fset-g77-defaults
1656 @emph{Version info:}
1657 This option was obsolete as of @code{egcs}
1659 The effect is instead achieved
1660 by the @code{lang_init_options} routine
1661 in @file{gcc/gcc/f/com.c}.
1663 @cindex consistency checks
1664 @cindex internal consistency checks
1665 @cindex checks, of internal consistency
1666 Set up whatever @code{gcc} options are to apply to Fortran
1667 compilations, and avoid running internal consistency checks
1668 that might take some time.
1670 This option is supplied automatically when compiling Fortran code
1671 via the @code{g77} or @code{gcc} command.
1672 The description of this option is provided so that users seeing
1673 it in the output of, say, @samp{g77 -v} understand why it is
1676 @cindex modifying g77
1677 @cindex code, modifying
1678 Also, developers who run @code{f771} directly might want to specify it
1679 by hand to get the same defaults as they would running @code{f771}
1680 via @code{g77} or @code{gcc}.
1681 However, such developers should, after linking a new @code{f771}
1682 executable, invoke it without this option once,
1683 e.g. via @kbd{./f771 -quiet < /dev/null},
1684 to ensure that they have not introduced any
1685 internal inconsistencies (such as in the table of
1686 intrinsics) before proceeding---@code{g77} will crash
1687 with a diagnostic if it detects an inconsistency.
1689 @cindex -fno-silent option
1690 @cindex options, -fno-silent
1691 @cindex f2c compatibility
1692 @cindex compatibility, f2c
1693 @cindex status, compilation
1694 @cindex compilation, status
1695 @cindex reporting compilation status
1696 @cindex printing compilation status
1698 Print (to @code{stderr}) the names of the program units as
1699 they are compiled, in a form similar to that used by popular
1700 UNIX @code{f77} implementations and @code{f2c}.
1703 @xref{Overall Options,,Options Controlling the Kind of Output,
1704 gcc,Using and Porting GNU CC}, for information
1705 on more options that control the overall operation of the @code{gcc} command
1706 (and, by extension, the @code{g77} command).
1708 @node Shorthand Options
1709 @section Shorthand Options
1710 @cindex shorthand options
1711 @cindex options, shorthand
1712 @cindex macro options
1713 @cindex options, macro
1715 The following options serve as ``shorthand''
1716 for other options accepted by the compiler:
1719 @cindex -fugly option
1720 @cindex options, -fugly
1722 @cindex ugly features
1723 @cindex features, ugly
1724 @emph{Note:} This option is no longer supported.
1725 The information, below, is provided to aid
1726 in the conversion of old scripts.
1728 Specify that certain ``ugly'' constructs are to be quietly accepted.
1732 -fugly-args -fugly-assign -fugly-assumed
1733 -fugly-comma -fugly-complex -fugly-init
1737 These constructs are considered inappropriate to use in new
1738 or well-maintained portable Fortran code, but widely used
1740 @xref{Distensions}, for more information.
1742 @cindex -fno-ugly option
1743 @cindex options, -fno-ugly
1745 @cindex ugly features
1746 @cindex features, ugly
1747 Specify that all ``ugly'' constructs are to be noisily rejected.
1751 -fno-ugly-args -fno-ugly-assign -fno-ugly-assumed
1752 -fno-ugly-comma -fno-ugly-complex -fno-ugly-init
1756 @xref{Distensions}, for more information.
1758 @cindex -ff66 option
1759 @cindex options, -ff66
1762 @cindex compatibility, FORTRAN 66
1763 Specify that the program is written in idiomatic FORTRAN 66.
1764 Same as @samp{-fonetrip -fugly-assumed}.
1766 The @samp{-fno-f66} option is the inverse of @samp{-ff66}.
1767 As such, it is the same as @samp{-fno-onetrip -fno-ugly-assumed}.
1769 The meaning of this option is likely to be refined as future
1770 versions of @code{g77} provide more compatibility with other
1771 existing and obsolete Fortran implementations.
1773 @cindex -ff77 option
1774 @cindex options, -ff77
1777 @cindex f2c compatibility
1778 @cindex compatibility, f2c
1779 @cindex f77 compatibility
1780 @cindex compatibility, f77
1781 Specify that the program is written in idiomatic UNIX FORTRAN 77
1782 and/or the dialect accepted by the @code{f2c} product.
1783 Same as @samp{-fbackslash -fno-typeless-boz}.
1785 The meaning of this option is likely to be refined as future
1786 versions of @code{g77} provide more compatibility with other
1787 existing and obsolete Fortran implementations.
1789 @cindex -fno-f77 option
1790 @cindex options, -fno-f77
1793 The @samp{-fno-f77} option is @emph{not} the inverse
1795 It specifies that the program is not written in idiomatic UNIX
1796 FORTRAN 77 or @code{f2c}, but in a more widely portable dialect.
1797 @samp{-fno-f77} is the same as @samp{-fno-backslash}.
1799 The meaning of this option is likely to be refined as future
1800 versions of @code{g77} provide more compatibility with other
1801 existing and obsolete Fortran implementations.
1804 @node Fortran Dialect Options
1805 @section Options Controlling Fortran Dialect
1806 @cindex dialect options
1807 @cindex language, dialect options
1808 @cindex options, dialect
1810 The following options control the dialect of Fortran
1811 that the compiler accepts:
1814 @cindex -ffree-form option
1815 @cindex options, -ffree-form
1816 @cindex -fno-fixed-form option
1817 @cindex options, -fno-fixed-form
1818 @cindex source file format
1821 @cindex Fortran 90, features
1823 @item -fno-fixed-form
1824 Specify that the source file is written in free form
1825 (introduced in Fortran 90) instead of the more-traditional fixed form.
1827 @cindex -ff90 option
1828 @cindex options, -ff90
1829 @cindex Fortran 90, features
1831 Allow certain Fortran-90 constructs.
1833 This option controls whether certain
1834 Fortran 90 constructs are recognized.
1835 (Other Fortran 90 constructs
1836 might or might not be recognized depending on other options such as
1837 @samp{-fvxt}, @samp{-ff90-intrinsics-enable}, and the
1838 current level of support for Fortran 90.)
1840 @xref{Fortran 90}, for more information.
1842 @cindex -fvxt option
1843 @cindex options, -fvxt
1845 @cindex Fortran 90, features
1846 @cindex VXT extensions
1847 Specify the treatment of certain constructs that have different
1848 meanings depending on whether the code is written in
1849 GNU Fortran (based on FORTRAN 77 and akin to Fortran 90)
1850 or VXT Fortran (more like VAX FORTRAN).
1852 The default is @samp{-fno-vxt}.
1853 @samp{-fvxt} specifies that the VXT Fortran interpretations
1854 for those constructs are to be chosen.
1856 @xref{VXT Fortran}, for more information.
1858 @cindex -fdollar-ok option
1859 @cindex options, -fdollar-ok
1862 @cindex symbol names
1863 @cindex character set
1864 Allow @samp{$} as a valid character in a symbol name.
1866 @cindex -fno-backslash option
1867 @cindex options, -fno-backslash
1868 @item -fno-backslash
1870 @cindex character constants
1871 @cindex Hollerith constants
1872 Specify that @samp{\} is not to be specially interpreted in character
1873 and Hollerith constants a la C and many UNIX Fortran compilers.
1875 For example, with @samp{-fbackslash} in effect, @samp{A\nB} specifies
1876 three characters, with the second one being newline.
1877 With @samp{-fno-backslash}, it specifies four characters,
1878 @samp{A}, @samp{\}, @samp{n}, and @samp{B}.
1880 Note that @code{g77} implements a fairly general form of backslash
1881 processing that is incompatible with the narrower forms supported
1882 by some other compilers.
1883 For example, @samp{'A\003B'} is a three-character string in @code{g77},
1884 whereas other compilers that support backslash might not support
1885 the three-octal-digit form, and thus treat that string as longer
1886 than three characters.
1888 @xref{Backslash in Constants}, for
1889 information on why @samp{-fbackslash} is the default
1890 instead of @samp{-fno-backslash}.
1892 @cindex -fno-ugly-args option
1893 @cindex options, -fno-ugly-args
1894 @item -fno-ugly-args
1895 Disallow passing Hollerith and typeless constants as actual
1896 arguments (for example, @samp{CALL FOO(4HABCD)}).
1898 @xref{Ugly Implicit Argument Conversion}, for more information.
1900 @cindex -fugly-assign option
1901 @cindex options, -fugly-assign
1903 Use the same storage for a given variable regardless of
1904 whether it is used to hold an assigned-statement label
1905 (as in @samp{ASSIGN 10 TO I}) or used to hold numeric data
1906 (as in @samp{I = 3}).
1908 @xref{Ugly Assigned Labels}, for more information.
1910 @cindex -fugly-assumed option
1911 @cindex options, -fugly-assumed
1912 @item -fugly-assumed
1913 Assume any dummy array with a final dimension specified as @samp{1}
1914 is really an assumed-size array, as if @samp{*} had been specified
1915 for the final dimension instead of @samp{1}.
1917 For example, @samp{DIMENSION X(1)} is treated as if it
1918 had read @samp{DIMENSION X(*)}.
1920 @xref{Ugly Assumed-Size Arrays}, for more information.
1922 @cindex -fugly-comma option
1923 @cindex options, -fugly-comma
1925 In an external-procedure invocation,
1926 treat a trailing comma in the argument list
1927 as specification of a trailing null argument,
1928 and treat an empty argument list
1929 as specification of a single null argument.
1931 For example, @samp{CALL FOO(,)} is treated as
1932 @samp{CALL FOO(%VAL(0), %VAL(0))}.
1933 That is, @emph{two} null arguments are specified
1934 by the procedure call when @samp{-fugly-comma} is in force.
1935 And @samp{F = FUNC()} is treated as @samp{F = FUNC(%VAL(0))}.
1937 The default behavior, @samp{-fno-ugly-comma}, is to ignore
1938 a single trailing comma in an argument list.
1939 So, by default, @samp{CALL FOO(X,)} is treated
1940 exactly the same as @samp{CALL FOO(X)}.
1942 @xref{Ugly Null Arguments}, for more information.
1944 @cindex -fugly-complex option
1945 @cindex options, -fugly-complex
1946 @item -fugly-complex
1947 Do not complain about @samp{REAL(@var{expr})} or
1948 @samp{AIMAG(@var{expr})} when @var{expr} is a @code{COMPLEX}
1949 type other than @code{COMPLEX(KIND=1)}---usually
1950 this is used to permit @code{COMPLEX(KIND=2)}
1951 (@code{DOUBLE COMPLEX}) operands.
1953 The @samp{-ff90} option controls the interpretation
1956 @xref{Ugly Complex Part Extraction}, for more information.
1958 @cindex -fno-ugly-init option
1959 @cindex options, -fno-ugly-init
1960 @item -fno-ugly-init
1961 Disallow use of Hollerith and typeless constants as initial
1962 values (in @code{PARAMETER} and @code{DATA} statements), and
1963 use of character constants to
1964 initialize numeric types and vice versa.
1966 For example, @samp{DATA I/'F'/, CHRVAR/65/, J/4HABCD/} is disallowed by
1967 @samp{-fno-ugly-init}.
1969 @xref{Ugly Conversion of Initializers}, for more information.
1971 @cindex -fugly-logint option
1972 @cindex options, -fugly-logint
1974 Treat @code{INTEGER} and @code{LOGICAL} variables and
1975 expressions as potential stand-ins for each other.
1977 For example, automatic conversion between @code{INTEGER} and
1978 @code{LOGICAL} is enabled, for many contexts, via this option.
1980 @xref{Ugly Integer Conversions}, for more information.
1982 @cindex -fonetrip option
1983 @cindex options, -fonetrip
1986 @cindex @code{DO} loops, one-trip
1987 @cindex one-trip @code{DO} loops
1988 @cindex @code{DO} loops, zero-trip
1989 @cindex zero-trip @code{DO} loops
1990 @cindex compatibility, FORTRAN 66
1991 Executable iterative @code{DO} loops are to be executed at
1992 least once each time they are reached.
1994 ANSI FORTRAN 77 and more recent versions of the Fortran standard
1995 specify that the body of an iterative @code{DO} loop is not executed
1996 if the number of iterations calculated from the parameters of the
1997 loop is less than 1.
1998 (For example, @samp{DO 10 I = 1, 0}.)
1999 Such a loop is called a @dfn{zero-trip loop}.
2001 Prior to ANSI FORTRAN 77, many compilers implemented @code{DO} loops
2002 such that the body of a loop would be executed at least once, even
2003 if the iteration count was zero.
2004 Fortran code written assuming this behavior is said to require
2005 @dfn{one-trip loops}.
2006 For example, some code written to the FORTRAN 66 standard
2007 expects this behavior from its @code{DO} loops, although that
2008 standard did not specify this behavior.
2010 The @samp{-fonetrip} option specifies that the source file(s) being
2011 compiled require one-trip loops.
2013 This option affects only those loops specified by the (iterative) @code{DO}
2014 statement and by implied-@code{DO} lists in I/O statements.
2015 Loops specified by implied-@code{DO} lists in @code{DATA} and
2016 specification (non-executable) statements are not affected.
2018 @cindex -ftypeless-boz option
2019 @cindex options, -ftypeless-boz
2020 @cindex prefix-radix constants
2021 @cindex constants, prefix-radix
2022 @cindex constants, types
2023 @cindex types, constants
2024 @item -ftypeless-boz
2025 Specifies that prefix-radix non-decimal constants, such as
2026 @samp{Z'ABCD'}, are typeless instead of @code{INTEGER(KIND=1)}.
2028 You can test for yourself whether a particular compiler treats
2029 the prefix form as @code{INTEGER(KIND=1)} or typeless by running the
2036 IF (J .EQ. I) PRINT *, 'Prefix form is TYPELESS'
2037 IF (J .NE. I) PRINT *, 'Prefix form is INTEGER'
2041 Reports indicate that many compilers process this form as
2042 @code{INTEGER(KIND=1)}, though a few as typeless, and at least one
2043 based on a command-line option specifying some kind of
2046 @cindex -fintrin-case-initcap option
2047 @cindex options, -fintrin-case-initcap
2048 @item -fintrin-case-initcap
2049 @cindex -fintrin-case-upper option
2050 @cindex options, -fintrin-case-upper
2051 @item -fintrin-case-upper
2052 @cindex -fintrin-case-lower option
2053 @cindex options, -fintrin-case-lower
2054 @item -fintrin-case-lower
2055 @cindex -fintrin-case-any option
2056 @cindex options, -fintrin-case-any
2057 @item -fintrin-case-any
2058 Specify expected case for intrinsic names.
2059 @samp{-fintrin-case-lower} is the default.
2061 @cindex -fmatch-case-initcap option
2062 @cindex options, -fmatch-case-initcap
2063 @item -fmatch-case-initcap
2064 @cindex -fmatch-case-upper option
2065 @cindex options, -fmatch-case-upper
2066 @item -fmatch-case-upper
2067 @cindex -fmatch-case-lower option
2068 @cindex options, -fmatch-case-lower
2069 @item -fmatch-case-lower
2070 @cindex -fmatch-case-any option
2071 @cindex options, -fmatch-case-any
2072 @item -fmatch-case-any
2073 Specify expected case for keywords.
2074 @samp{-fmatch-case-lower} is the default.
2076 @cindex -fsource-case-upper option
2077 @cindex options, -fsource-case-upper
2078 @item -fsource-case-upper
2079 @cindex -fsource-case-lower option
2080 @cindex options, -fsource-case-lower
2081 @item -fsource-case-lower
2082 @cindex -fsource-case-preserve option
2083 @cindex options, -fsource-case-preserve
2084 @item -fsource-case-preserve
2085 Specify whether source text other than character and Hollerith constants
2086 is to be translated to uppercase, to lowercase, or preserved as is.
2087 @samp{-fsource-case-lower} is the default.
2089 @cindex -fsymbol-case-initcap option
2090 @cindex options, -fsymbol-case-initcap
2091 @item -fsymbol-case-initcap
2092 @cindex -fsymbol-case-upper option
2093 @cindex options, -fsymbol-case-upper
2094 @item -fsymbol-case-upper
2095 @cindex -fsymbol-case-lower option
2096 @cindex options, -fsymbol-case-lower
2097 @item -fsymbol-case-lower
2098 @cindex -fsymbol-case-any option
2099 @cindex options, -fsymbol-case-any
2100 @item -fsymbol-case-any
2101 Specify valid cases for user-defined symbol names.
2102 @samp{-fsymbol-case-any} is the default.
2104 @cindex -fcase-strict-upper option
2105 @cindex options, -fcase-strict-upper
2106 @item -fcase-strict-upper
2107 Same as @samp{-fintrin-case-upper -fmatch-case-upper -fsource-case-preserve
2108 -fsymbol-case-upper}.
2109 (Requires all pertinent source to be in uppercase.)
2111 @cindex -fcase-strict-lower option
2112 @cindex options, -fcase-strict-lower
2113 @item -fcase-strict-lower
2114 Same as @samp{-fintrin-case-lower -fmatch-case-lower -fsource-case-preserve
2115 -fsymbol-case-lower}.
2116 (Requires all pertinent source to be in lowercase.)
2118 @cindex -fcase-initcap option
2119 @cindex options, -fcase-initcap
2120 @item -fcase-initcap
2121 Same as @samp{-fintrin-case-initcap -fmatch-case-initcap -fsource-case-preserve
2122 -fsymbol-case-initcap}.
2123 (Requires all pertinent source to be in initial capitals,
2124 as in @samp{Print *,SqRt(Value)}.)
2126 @cindex -fcase-upper option
2127 @cindex options, -fcase-upper
2129 Same as @samp{-fintrin-case-any -fmatch-case-any -fsource-case-upper
2131 (Maps all pertinent source to uppercase.)
2133 @cindex -fcase-lower option
2134 @cindex options, -fcase-lower
2136 Same as @samp{-fintrin-case-any -fmatch-case-any -fsource-case-lower
2138 (Maps all pertinent source to lowercase.)
2140 @cindex -fcase-preserve option
2141 @cindex options, -fcase-preserve
2142 @item -fcase-preserve
2143 Same as @samp{-fintrin-case-any -fmatch-case-any -fsource-case-preserve
2145 (Preserves all case in user-defined symbols,
2146 while allowing any-case matching of intrinsics and keywords.
2147 For example, @samp{call Foo(i,I)} would pass two @emph{different}
2148 variables named @samp{i} and @samp{I} to a procedure named @samp{Foo}.)
2150 @cindex -fbadu77-intrinsics-delete option
2151 @cindex options, -fbadu77-intrinsics-delete
2152 @item -fbadu77-intrinsics-delete
2153 @cindex -fbadu77-intrinsics-hide option
2154 @cindex options, -fbadu77-intrinsics-hide
2155 @item -fbadu77-intrinsics-hide
2156 @cindex -fbadu77-intrinsics-disable option
2157 @cindex options, -fbadu77-intrinsics-disable
2158 @item -fbadu77-intrinsics-disable
2159 @cindex -fbadu77-intrinsics-enable option
2160 @cindex options, -fbadu77-intrinsics-enable
2161 @item -fbadu77-intrinsics-enable
2162 @cindex @code{badu77} intrinsics
2163 @cindex intrinsics, @code{badu77}
2164 Specify status of UNIX intrinsics having inappropriate forms.
2165 @samp{-fbadu77-intrinsics-enable} is the default.
2166 @xref{Intrinsic Groups}.
2168 @cindex -ff2c-intrinsics-delete option
2169 @cindex options, -ff2c-intrinsics-delete
2170 @item -ff2c-intrinsics-delete
2171 @cindex -ff2c-intrinsics-hide option
2172 @cindex options, -ff2c-intrinsics-hide
2173 @item -ff2c-intrinsics-hide
2174 @cindex -ff2c-intrinsics-disable option
2175 @cindex options, -ff2c-intrinsics-disable
2176 @item -ff2c-intrinsics-disable
2177 @cindex -ff2c-intrinsics-enable option
2178 @cindex options, -ff2c-intrinsics-enable
2179 @item -ff2c-intrinsics-enable
2180 @cindex @code{f2c} intrinsics
2181 @cindex intrinsics, @code{f2c}
2182 Specify status of f2c-specific intrinsics.
2183 @samp{-ff2c-intrinsics-enable} is the default.
2184 @xref{Intrinsic Groups}.
2186 @cindex -ff90-intrinsics-delete option
2187 @cindex options, -ff90-intrinsics-delete
2188 @item -ff90-intrinsics-delete
2189 @cindex -ff90-intrinsics-hide option
2190 @cindex options, -ff90-intrinsics-hide
2191 @item -ff90-intrinsics-hide
2192 @cindex -ff90-intrinsics-disable option
2193 @cindex options, -ff90-intrinsics-disable
2194 @item -ff90-intrinsics-disable
2195 @cindex -ff90-intrinsics-enable option
2196 @cindex options, -ff90-intrinsics-enable
2197 @item -ff90-intrinsics-enable
2198 @cindex Fortran 90, intrinsics
2199 @cindex intrinsics, Fortran 90
2200 Specify status of F90-specific intrinsics.
2201 @samp{-ff90-intrinsics-enable} is the default.
2202 @xref{Intrinsic Groups}.
2204 @cindex -fgnu-intrinsics-delete option
2205 @cindex options, -fgnu-intrinsics-delete
2206 @item -fgnu-intrinsics-delete
2207 @cindex -fgnu-intrinsics-hide option
2208 @cindex options, -fgnu-intrinsics-hide
2209 @item -fgnu-intrinsics-hide
2210 @cindex -fgnu-intrinsics-disable option
2211 @cindex options, -fgnu-intrinsics-disable
2212 @item -fgnu-intrinsics-disable
2213 @cindex -fgnu-intrinsics-enable option
2214 @cindex options, -fgnu-intrinsics-enable
2215 @item -fgnu-intrinsics-enable
2216 @cindex Digital Fortran features
2217 @cindex @code{COMPLEX} intrinsics
2218 @cindex intrinsics, @code{COMPLEX}
2219 Specify status of Digital's COMPLEX-related intrinsics.
2220 @samp{-fgnu-intrinsics-enable} is the default.
2221 @xref{Intrinsic Groups}.
2223 @cindex -fmil-intrinsics-delete option
2224 @cindex options, -fmil-intrinsics-delete
2225 @item -fmil-intrinsics-delete
2226 @cindex -fmil-intrinsics-hide option
2227 @cindex options, -fmil-intrinsics-hide
2228 @item -fmil-intrinsics-hide
2229 @cindex -fmil-intrinsics-disable option
2230 @cindex options, -fmil-intrinsics-disable
2231 @item -fmil-intrinsics-disable
2232 @cindex -fmil-intrinsics-enable option
2233 @cindex options, -fmil-intrinsics-enable
2234 @item -fmil-intrinsics-enable
2235 @cindex MIL-STD 1753
2236 @cindex intrinsics, MIL-STD 1753
2237 Specify status of MIL-STD-1753-specific intrinsics.
2238 @samp{-fmil-intrinsics-enable} is the default.
2239 @xref{Intrinsic Groups}.
2241 @cindex -funix-intrinsics-delete option
2242 @cindex options, -funix-intrinsics-delete
2243 @item -funix-intrinsics-delete
2244 @cindex -funix-intrinsics-hide option
2245 @cindex options, -funix-intrinsics-hide
2246 @item -funix-intrinsics-hide
2247 @cindex -funix-intrinsics-disable option
2248 @cindex options, -funix-intrinsics-disable
2249 @item -funix-intrinsics-disable
2250 @cindex -funix-intrinsics-enable option
2251 @cindex options, -funix-intrinsics-enable
2252 @item -funix-intrinsics-enable
2253 @cindex UNIX intrinsics
2254 @cindex intrinsics, UNIX
2255 Specify status of UNIX intrinsics.
2256 @samp{-funix-intrinsics-enable} is the default.
2257 @xref{Intrinsic Groups}.
2259 @cindex -fvxt-intrinsics-delete option
2260 @cindex options, -fvxt-intrinsics-delete
2261 @item -fvxt-intrinsics-delete
2262 @cindex -fvxt-intrinsics-hide option
2263 @cindex options, -fvxt-intrinsics-hide
2264 @item -fvxt-intrinsics-hide
2265 @cindex -fvxt-intrinsics-disable option
2266 @cindex options, -fvxt-intrinsics-disable
2267 @item -fvxt-intrinsics-disable
2268 @cindex -fvxt-intrinsics-enable option
2269 @cindex options, -fvxt-intrinsics-enable
2270 @item -fvxt-intrinsics-enable
2271 @cindex VXT intrinsics
2272 @cindex intrinsics, VXT
2273 Specify status of VXT intrinsics.
2274 @samp{-fvxt-intrinsics-enable} is the default.
2275 @xref{Intrinsic Groups}.
2277 @cindex -ffixed-line-length-@var{n} option
2278 @cindex options, -ffixed-line-length-@var{n}
2279 @item -ffixed-line-length-@var{n}
2280 @cindex source file format
2281 @cindex lines, length
2282 @cindex length of source lines
2284 @cindex limits, lengths of source lines
2285 Set column after which characters are ignored in typical fixed-form
2286 lines in the source file, and through which spaces are assumed (as
2287 if padded to that length) after the ends of short fixed-form lines.
2290 @cindex extended-source option
2291 Popular values for @var{n} include 72 (the
2292 standard and the default), 80 (card image), and 132 (corresponds
2293 to ``extended-source'' options in some popular compilers).
2294 @var{n} may be @samp{none}, meaning that the entire line is meaningful
2295 and that continued character constants never have implicit spaces appended
2296 to them to fill out the line.
2297 @samp{-ffixed-line-length-0} means the same thing as
2298 @samp{-ffixed-line-length-none}.
2300 @xref{Source Form}, for more information.
2303 @node Warning Options
2304 @section Options to Request or Suppress Warnings
2305 @cindex options, warnings
2306 @cindex warnings, suppressing
2307 @cindex messages, warning
2308 @cindex suppressing warnings
2310 Warnings are diagnostic messages that report constructions which
2311 are not inherently erroneous but which are risky or suggest there
2312 might have been an error.
2314 You can request many specific warnings with options beginning @samp{-W},
2315 for example @samp{-Wimplicit} to request warnings on implicit
2316 declarations. Each of these specific warning options also has a
2317 negative form beginning @samp{-Wno-} to turn off warnings;
2318 for example, @samp{-Wno-implicit}. This manual lists only one of the
2319 two forms, whichever is not the default.
2321 These options control the amount and kinds of warnings produced by GNU
2325 @cindex syntax checking
2326 @cindex -fsyntax-only option
2327 @cindex options, -fsyntax-only
2329 Check the code for syntax errors, but don't do anything beyond that.
2331 @cindex -pedantic option
2332 @cindex options, -pedantic
2334 Issue warnings for uses of extensions to ANSI FORTRAN 77.
2335 @samp{-pedantic} also applies to C-language constructs where they
2336 occur in GNU Fortran source files, such as use of @samp{\e} in a
2337 character constant within a directive like @samp{#include}.
2339 Valid ANSI FORTRAN 77 programs should compile properly with or without
2341 However, without this option, certain GNU extensions and traditional
2342 Fortran features are supported as well.
2343 With this option, many of them are rejected.
2345 Some users try to use @samp{-pedantic} to check programs for strict ANSI
2347 They soon find that it does not do quite what they want---it finds some
2348 non-ANSI practices, but not all.
2349 However, improvements to @code{g77} in this area are welcome.
2351 @cindex -pedantic-errors option
2352 @cindex options, -pedantic-errors
2353 @item -pedantic-errors
2354 Like @samp{-pedantic}, except that errors are produced rather than
2357 @cindex -fpedantic option
2358 @cindex options, -fpedantic
2360 Like @samp{-pedantic}, but applies only to Fortran constructs.
2365 Inhibit all warning messages.
2367 @cindex -Wno-globals option
2368 @cindex options, -Wno-globals
2370 @cindex global names, warning
2371 @cindex warnings, global names
2372 Inhibit warnings about use of a name as both a global name
2373 (a subroutine, function, or block data program unit, or a
2374 common block) and implicitly as the name of an intrinsic
2377 Also inhibit warnings about inconsistent invocations and/or
2378 definitions of global procedures (function and subroutines).
2379 Such inconsistencies include different numbers of arguments
2380 and different types of arguments.
2382 @cindex -Wimplicit option
2383 @cindex options, -Wimplicit
2385 @cindex implicit declaration, warning
2386 @cindex warnings, implicit declaration
2388 @cindex /WARNINGS=DECLARATIONS switch
2389 @cindex IMPLICIT NONE, similar effect
2390 @cindex effecting IMPLICIT NONE
2391 Warn whenever a variable, array, or function is implicitly
2393 Has an effect similar to using the @code{IMPLICIT NONE} statement
2394 in every program unit.
2395 (Some Fortran compilers provide this feature by an option
2396 named @samp{-u} or @samp{/WARNINGS=DECLARATIONS}.)
2398 @cindex -Wunused option
2399 @cindex options, -Wunused
2401 @cindex unused variables
2402 @cindex variables, unused
2403 Warn whenever a variable is unused aside from its declaration.
2405 @cindex -Wuninitialized option
2406 @cindex options, -Wuninitialized
2407 @item -Wuninitialized
2408 @cindex uninitialized variables
2409 @cindex variables, uninitialized
2410 Warn whenever an automatic variable is used without first being initialized.
2412 These warnings are possible only in optimizing compilation,
2413 because they require data-flow information that is computed only
2414 when optimizing. If you don't specify @samp{-O}, you simply won't
2417 These warnings occur only for variables that are candidates for
2418 register allocation. Therefore, they do not occur for a variable
2419 @c that is declared @code{VOLATILE}, or
2420 whose address is taken, or whose size
2421 is other than 1, 2, 4 or 8 bytes. Also, they do not occur for
2422 arrays, even when they are in registers.
2424 Note that there might be no warning about a variable that is used only
2425 to compute a value that itself is never used, because such
2426 computations may be deleted by data-flow analysis before the warnings
2429 These warnings are made optional because GNU Fortran is not smart
2430 enough to see all the reasons why the code might be correct
2431 despite appearing to have an error. Here is one example of how
2435 SUBROUTINE DISPAT(J)
2444 If the value of @code{J} is always 1, 2 or 3, then @code{I} is
2445 always initialized, but GNU Fortran doesn't know this. Here is
2446 another common case:
2449 SUBROUTINE MAYBE(FLAG)
2451 IF (FLAG) VALUE = 9.4
2453 IF (FLAG) PRINT *, VALUE
2458 This has no bug because @code{VALUE} is used only if it is set.
2460 @cindex -Wall option
2461 @cindex options, -Wall
2463 @cindex all warnings
2464 @cindex warnings, all
2465 The @samp{-Wunused} and @samp{-Wuninitialized} options combined.
2467 options which pertain to usage that we recommend avoiding and that we
2468 believe is easy to avoid.
2469 (As more warnings are added to @code{g77}, some might
2470 be added to the list enabled by @samp{-Wall}.)
2473 The remaining @samp{-W@dots{}} options are not implied by @samp{-Wall}
2474 because they warn about constructions that we consider reasonable to
2475 use, on occasion, in clean programs.
2479 @c Print extra warning messages for these events:
2483 @c If @samp{-Wall} or @samp{-Wunused} is also specified, warn about unused
2488 @cindex -Wsurprising option
2489 @cindex options, -Wsurprising
2491 Warn about ``suspicious'' constructs that are interpreted
2492 by the compiler in a way that might well be surprising to
2493 someone reading the code.
2494 These differences can result in subtle, compiler-dependent
2495 (even machine-dependent) behavioral differences.
2496 The constructs warned about include:
2500 Expressions having two arithmetic operators in a row, such
2502 Such a construct is nonstandard, and can produce
2503 unexpected results in more complicated situations such
2505 @code{g77}, along with many other compilers, interprets
2506 this example differently than many programmers, and a few
2508 Specifically, @code{g77} interprets @samp{X**-Y*Z} as
2509 @samp{(X**(-Y))*Z}, while others might think it should
2510 be interpreted as @samp{X**(-(Y*Z))}.
2512 A revealing example is the constant expression @samp{2**-2*1.},
2513 which @code{g77} evaluates to .25, while others might evaluate
2514 it to 0., the difference resulting from the way precedence affects
2517 (The @samp{-fpedantic} option also warns about expressions
2518 having two arithmetic operators in a row.)
2521 Expressions with a unary minus followed by an operand and then
2522 a binary operator other than plus or minus.
2523 For example, @samp{-2**2} produces a warning, because
2524 the precedence is @samp{-(2**2)}, yielding -4, not
2525 @samp{(-2)**2}, which yields 4, and which might represent
2526 what a programmer expects.
2528 An example of an expression producing different results
2529 in a surprising way is @samp{-I*S}, where @var{I} holds
2530 the value @samp{-2147483648} and @var{S} holds @samp{0.5}.
2531 On many systems, negating @var{I} results in the same
2532 value, not a positive number, because it is already the
2533 lower bound of what an @code{INTEGER(KIND=1)} variable can hold.
2534 So, the expression evaluates to a positive number, while
2535 the ``expected'' interpretation, @samp{(-I)*S}, would
2536 evaluate to a negative number.
2538 Even cases such as @samp{-I*J} produce warnings,
2539 even though, in most configurations and situations,
2540 there is no computational difference between the
2541 results of the two interpretations---the purpose
2542 of this warning is to warn about differing interpretations
2543 and encourage a better style of coding, not to identify
2544 only those places where bugs might exist in the user's
2547 @cindex DO statement
2548 @cindex statements, DO
2550 @code{DO} loops with @code{DO} variables that are not
2551 of integral type---that is, using @code{REAL}
2552 variables as loop control variables.
2553 Although such loops can be written to work in the
2554 ``obvious'' way, the way @code{g77} is required by the
2555 Fortran standard to interpret such code is likely to
2556 be quite different from the way many programmers expect.
2557 (This is true of all @code{DO} loops, but the differences
2558 are pronounced for non-integral loop control variables.)
2560 @xref{Loops}, for more information.
2563 @cindex -Werror option
2564 @cindex options, -Werror
2566 Make all warnings into errors.
2571 @cindex extra warnings
2572 @cindex warnings, extra
2573 Turns on ``extra warnings'' and, if optimization is specified
2574 via @samp{-O}, the @samp{-Wuninitialized} option.
2575 (This might change in future versions of @code{g77}.)
2577 ``Extra warnings'' are issued for:
2581 @cindex unused parameters
2582 @cindex parameters, unused
2583 @cindex unused arguments
2584 @cindex arguments, unused
2585 @cindex unused dummies
2586 @cindex dummies, unused
2587 Unused parameters to a procedure (when @samp{-Wunused} also is
2592 Overflows involving floating-point constants (not available
2593 for certain configurations).
2597 @xref{Warning Options,,Options to Request or Suppress Warnings,
2598 gcc,Using and Porting GNU CC}, for information on more options offered
2599 by the GBE shared by @code{g77}, @code{gcc}, and other GNU compilers.
2601 Some of these have no effect when compiling programs written in Fortran:
2604 @cindex -Wcomment option
2605 @cindex options, -Wcomment
2607 @cindex -Wformat option
2608 @cindex options, -Wformat
2610 @cindex -Wparentheses option
2611 @cindex options, -Wparentheses
2613 @cindex -Wswitch option
2614 @cindex options, -Wswitch
2616 @cindex -Wtraditional option
2617 @cindex options, -Wtraditional
2619 @cindex -Wshadow option
2620 @cindex options, -Wshadow
2622 @cindex -Wid-clash-@var{len} option
2623 @cindex options, -Wid-clash-@var{len}
2624 @item -Wid-clash-@var{len}
2625 @cindex -Wlarger-than-@var{len} option
2626 @cindex options, -Wlarger-than-@var{len}
2627 @item -Wlarger-than-@var{len}
2628 @cindex -Wconversion option
2629 @cindex options, -Wconversion
2631 @cindex -Waggregate-return option
2632 @cindex options, -Waggregate-return
2633 @item -Waggregate-return
2634 @cindex -Wredundant-decls option
2635 @cindex options, -Wredundant-decls
2636 @item -Wredundant-decls
2637 @cindex unsupported warnings
2638 @cindex warnings, unsupported
2639 These options all could have some relevant meaning for
2640 GNU Fortran programs, but are not yet supported.
2643 @node Debugging Options
2644 @section Options for Debugging Your Program or GNU Fortran
2645 @cindex options, debugging
2646 @cindex debugging information options
2648 GNU Fortran has various special options that are used for debugging
2649 either your program or @code{g77}.
2655 Produce debugging information in the operating system's native format
2656 (stabs, COFF, XCOFF, or DWARF). GDB can work with this debugging
2659 @cindex common blocks
2660 @cindex equivalence areas
2661 @cindex missing debug features
2662 Support for this option in Fortran programs was incomplete up till
2663 version 0.5.26 of @code{g77}.
2664 In particular, names of variables and arrays in common blocks
2665 or that are storage-associated via @code{EQUIVALENCE} were
2666 unavailable to the debugger.
2668 However, version 0.5.19 of @code{g77} does provide this information
2669 in a rudimentary way, as controlled by the
2670 @samp{-fdebug-kludge} option.
2672 Because version 0.5.26 of @code{g77} enables full debug information
2673 of COMMON BLOCK and EQUIVALENCE items, this option has been disabled.
2675 @xref{Code Gen Options,,Options for Code Generation Conventions},
2676 for more information.
2679 @xref{Debugging Options,,Options for Debugging Your Program or GNU CC,
2680 gcc,Using and Porting GNU CC}, for more information on debugging options.
2682 @node Optimize Options
2683 @section Options That Control Optimization
2684 @cindex optimize options
2685 @cindex options, optimization
2687 Most Fortran users will want to use no optimization when
2688 developing and testing programs, and use @samp{-O} or @samp{-O2} when
2689 compiling programs for late-cycle testing and for production use.
2690 However, note that certain diagnostics---such as for uninitialized
2691 variables---depend on the flow analysis done by @samp{-O}, i.e.@: you
2692 must use @samp{-O} or @samp{-O2} to get such diagnostics.
2694 The following flags have particular applicability when
2695 compiling Fortran programs:
2698 @cindex -malign-double option
2699 @cindex options, -malign-double
2700 @item -malign-double
2701 (Intel x86 architecture only.)
2703 Noticeably improves performance of @code{g77} programs making
2704 heavy use of @code{REAL(KIND=2)} (@code{DOUBLE PRECISION}) data
2706 In particular, systems using Pentium, Pentium Pro, 586, and
2708 of the i386 architecture execute programs faster when
2709 @code{REAL(KIND=2)} (@code{DOUBLE PRECISION}) data are
2710 aligned on 64-bit boundaries
2713 This option can, at least, make benchmark results more consistent
2714 across various system configurations, versions of the program,
2717 @emph{Note:} The warning in the @code{gcc} documentation about
2718 this option does not apply, generally speaking, to Fortran
2719 code compiled by @code{g77}.
2721 @xref{Aligned Data}, for more information on alignment issues.
2723 @emph{Also also note:} The negative form of @samp{-malign-double}
2724 is @samp{-mno-align-double}, not @samp{-benign-double}.
2726 @cindex -ffloat-store option
2727 @cindex options, -ffloat-store
2729 @cindex IEEE 754 conformance
2730 @cindex conformance, IEEE 754
2731 @cindex floating-point, precision
2732 Might help a Fortran program that depends on exact IEEE conformance on
2733 some machines, but might slow down a program that doesn't.
2735 This option is effective when the floating-point unit is set to work in
2736 IEEE 854 `extended precision'---as it typically is on x86 and m68k GNU
2737 systems---rather than IEEE 754 double precision. @samp{-ffloat-store}
2738 tries to remove the extra precision by spilling data from floating-point
2739 registers into memory and this typically involves a big performance
2740 hit. However, it doesn't affect intermediate results, so that it is
2741 only partially effective. `Excess precision' is avoided in code like:
2746 but not in code like:
2751 For another, potentially better, way of controlling the precision,
2752 see @ref{Floating-point precision}.
2754 @cindex -fforce-mem option
2755 @cindex options, -fforce-mem
2757 @cindex -fforce-addr option
2758 @cindex options, -fforce-addr
2760 @cindex loops, speeding up
2761 @cindex speed, of loops
2762 Might improve optimization of loops.
2764 @cindex -fno-inline option
2765 @cindex options, -fno-inline
2767 @cindex in-line code
2768 @cindex compilation, in-line
2769 @c DL: Only relevant for -O3?
2770 Don't compile statement functions inline.
2771 Might reduce the size of a program unit---which might be at
2772 expense of some speed (though it should compile faster).
2773 Note that if you are not optimizing, no functions can be expanded inline.
2775 @cindex -ffast-math option
2776 @cindex options, -ffast-math
2778 @cindex IEEE 754 conformance
2779 @cindex conformance, IEEE 754
2780 Might allow some programs designed to not be too dependent
2781 on IEEE behavior for floating-point to run faster, or die trying.
2783 @cindex -fstrength-reduce option
2784 @cindex options, -fstrength-reduce
2785 @item -fstrength-reduce
2786 @cindex loops, speeding up
2787 @cindex speed, of loops
2788 @c DL: normally defaulted?
2789 Might make some loops run faster.
2791 @cindex -frerun-cse-after-loop option
2792 @cindex options, -frerun-cse-after-loop
2793 @item -frerun-cse-after-loop
2794 @cindex -fexpensive-optimizations option
2795 @cindex options, -fexpensive-optimizations
2797 @item -fexpensive-optimizations
2798 @cindex -fdelayed-branch option
2799 @cindex options, -fdelayed-branch
2800 @item -fdelayed-branch
2801 @cindex -fschedule-insns option
2802 @cindex options, -fschedule-insns
2803 @item -fschedule-insns
2804 @cindex -fschedule-insns2 option
2805 @cindex options, -fschedule-insns2
2806 @item -fschedule-insns2
2807 @cindex -fcaller-saves option
2808 @cindex options, -fcaller-saves
2809 @item -fcaller-saves
2810 Might improve performance on some code.
2812 @cindex -funroll-loops option
2813 @cindex options, -funroll-loops
2814 @item -funroll-loops
2815 @cindex loops, unrolling
2816 @cindex unrolling loops
2817 @cindex loops, optimizing
2818 @cindex indexed (iterative) @code{DO}
2819 @cindex iterative @code{DO}
2820 @c DL: fixme: Craig doesn't like `indexed' but f95 doesn't seem to
2821 @c provide a suitable term
2822 @c CB: I've decided on `iterative', for the time being, and changed
2823 @c my previous, rather bizarre, use of `imperative' to that
2824 @c (though `precomputed-trip' would be a more precise adjective)
2825 Typically improves performance on code using iterative @code{DO} loops by
2826 unrolling them and is probably generally appropriate for Fortran, though
2827 it is not turned on at any optimization level.
2828 Note that outer loop unrolling isn't done specifically; decisions about
2829 whether to unroll a loop are made on the basis of its instruction count.
2831 @c DL: Fixme: This should obviously go somewhere else...
2832 Also, no `loop discovery'@footnote{@dfn{loop discovery} refers to the
2833 process by which a compiler, or indeed any reader of a program,
2834 determines which portions of the program are more likely to be executed
2835 repeatedly as it is being run. Such discovery typically is done early
2836 when compiling using optimization techniques, so the ``discovered''
2837 loops get more attention---and more run-time resources, such as
2838 registers---from the compiler. It is easy to ``discover'' loops that are
2839 constructed out of looping constructs in the language
2840 (such as Fortran's @code{DO}). For some programs, ``discovering'' loops
2841 constructed out of lower-level constructs (such as @code{IF} and
2842 @code{GOTO}) can lead to generation of more optimal code
2843 than otherwise.} is done, so only loops written with @code{DO}
2844 benefit from loop optimizations, including---but not limited
2845 to---unrolling. Loops written with @code{IF} and @code{GOTO} are not
2846 currently recognized as such. This option unrolls only iterative
2847 @code{DO} loops, not @code{DO WHILE} loops.
2849 @cindex -funroll-all-loops option
2850 @cindex options, -funroll-all-loops
2852 @item -funroll-all-loops
2853 @c DL: Check my understanding of -funroll-all-loops v. -funroll-loops is correct.
2854 Probably improves performance on code using @code{DO WHILE} loops by
2855 unrolling them in addition to iterative @code{DO} loops. In the absence
2856 of @code{DO WHILE}, this option is equivalent to @samp{-funroll-loops}
2857 but possibly slower.
2859 @item -fno-move-all-movables
2860 @cindex -fno-move-all-movables option
2861 @cindex options, -fno-move-all-movables
2862 @item -fno-reduce-all-givs
2863 @cindex -fno-reduce-all-givs option
2864 @cindex options, -fno-reduce-all-givs
2865 @item -fno-rerun-loop-opt
2866 @cindex -fno-rerun-loop-opt option
2867 @cindex options, -fno-rerun-loop-opt
2868 @emph{Version info:}
2869 These options are not supported by
2870 versions of @code{g77} based on @code{gcc} version 2.8.
2872 Each of these might improve performance on some code.
2874 Analysis of Fortran code optimization and the resulting
2875 optimizations triggered by the above options were
2876 contributed by Toon Moene (@email{toon@@moene.indiv.nluug.nl}).
2878 These three options are intended to be removed someday, once
2879 they have helped determine the efficacy of various
2880 approaches to improving the performance of Fortran code.
2882 Please let us know how use of these options affects
2883 the performance of your production code.
2884 We're particularly interested in code that runs faster
2885 when these options are @emph{disabled}, and in
2886 non-Fortran code that benefits when they are
2887 @emph{enabled} via the above @code{gcc} command-line options.
2890 @xref{Optimize Options,,Options That Control Optimization,
2891 gcc,Using and Porting GNU CC}, for more information on options
2892 to optimize the generated machine code.
2894 @node Preprocessor Options
2895 @section Options Controlling the Preprocessor
2896 @cindex preprocessor options
2897 @cindex options, preprocessor
2899 @cindex programs, cpp
2901 These options control the C preprocessor, which is run on each C source
2902 file before actual compilation.
2904 @xref{Preprocessor Options,,Options Controlling the Preprocessor,
2905 gcc,Using and Porting GNU CC}, for information on C preprocessor options.
2907 @cindex INCLUDE directive
2908 @cindex directive, INCLUDE
2909 Some of these options also affect how @code{g77} processes the
2910 @code{INCLUDE} directive.
2911 Since this directive is processed even when preprocessing
2912 is not requested, it is not described in this section.
2913 @xref{Directory Options,,Options for Directory Search}, for
2914 information on how @code{g77} processes the @code{INCLUDE} directive.
2916 However, the @code{INCLUDE} directive does not apply
2917 preprocessing to the contents of the included file itself.
2919 Therefore, any file that contains preprocessor directives
2920 (such as @code{#include}, @code{#define}, and @code{#if})
2921 must be included via the @code{#include} directive, not
2922 via the @code{INCLUDE} directive.
2923 Therefore, any file containing preprocessor directives,
2924 if included, is necessarily included by a file that itself
2925 contains preprocessor directives.
2927 @node Directory Options
2928 @section Options for Directory Search
2929 @cindex directory, options
2930 @cindex options, directory search
2933 These options affect how the @code{cpp} preprocessor searches
2934 for files specified via the @code{#include} directive.
2935 Therefore, when compiling Fortran programs, they are meaningful
2936 when the preprocessor is used.
2938 @cindex INCLUDE directive
2939 @cindex directive, INCLUDE
2940 Some of these options also affect how @code{g77} searches
2941 for files specified via the @code{INCLUDE} directive,
2942 although files included by that directive are not,
2943 themselves, preprocessed.
2948 @cindex options, -I-
2950 @cindex -Idir option
2951 @cindex options, -Idir
2953 @cindex directory, search paths for inclusion
2954 @cindex inclusion, directory search paths for
2955 @cindex search paths, for included files
2956 @cindex paths, search
2957 These affect interpretation of the @code{INCLUDE} directive
2958 (as well as of the @code{#include} directive of the @code{cpp}
2961 Note that @samp{-I@var{dir}} must be specified @emph{without} any
2962 spaces between @samp{-I} and the directory name---that is,
2963 @samp{-Ifoo/bar} is valid, but @samp{-I foo/bar}
2964 is rejected by the @code{g77} compiler (though the preprocessor supports
2966 @c this is due to toplev.c's inflexible option processing
2967 Also note that the general behavior of @samp{-I} and
2968 @code{INCLUDE} is pretty much the same as of @samp{-I} with
2969 @code{#include} in the @code{cpp} preprocessor, with regard to
2970 looking for @file{header.gcc} files and other such things.
2972 @xref{Directory Options,,Options for Directory Search,
2973 gcc,Using and Porting GNU CC}, for information on the @samp{-I} option.
2976 @node Code Gen Options
2977 @section Options for Code Generation Conventions
2978 @cindex code generation, conventions
2979 @cindex options, code generation
2980 @cindex run-time, options
2982 These machine-independent options control the interface conventions
2983 used in code generation.
2985 Most of them have both positive and negative forms; the negative form
2986 of @samp{-ffoo} would be @samp{-fno-foo}. In the table below, only
2987 one of the forms is listed---the one which is not the default. You
2988 can figure out the other form by either removing @samp{no-} or adding
2992 @cindex -fno-automatic option
2993 @cindex options, -fno-automatic
2994 @item -fno-automatic
2995 @cindex SAVE statement
2996 @cindex statements, SAVE
2997 Treat each program unit as if the @code{SAVE} statement was specified
2998 for every local variable and array referenced in it.
2999 Does not affect common blocks.
3000 (Some Fortran compilers provide this option under
3001 the name @samp{-static}.)
3003 @cindex -finit-local-zero option
3004 @cindex options, -finit-local-zero
3005 @item -finit-local-zero
3006 @cindex DATA statement
3007 @cindex statements, DATA
3008 @cindex initialization, of local variables
3009 @cindex variables, initialization of
3010 @cindex uninitialized variables
3011 @cindex variables, uninitialized
3012 Specify that variables and arrays that are local to a program unit
3013 (not in a common block and not passed as an argument) are to be initialized
3016 Since there is a run-time penalty for initialization of variables
3017 that are not given the @code{SAVE} attribute, it might be a
3018 good idea to also use @samp{-fno-automatic} with @samp{-finit-local-zero}.
3020 @cindex -fno-f2c option
3021 @cindex options, -fno-f2c
3023 @cindex @code{f2c} compatibility
3024 @cindex compatibility, @code{f2c}
3025 Do not generate code designed to be compatible with code generated
3026 by @code{f2c}; use the GNU calling conventions instead.
3028 The @code{f2c} calling conventions require functions that return
3029 type @code{REAL(KIND=1)} to actually return the C type @code{double},
3030 and functions that return type @code{COMPLEX} to return the
3031 values via an extra argument in the calling sequence that points
3032 to where to store the return value.
3033 Under the GNU calling conventions, such functions simply return
3034 their results as they would in GNU C---@code{REAL(KIND=1)} functions
3035 return the C type @code{float}, and @code{COMPLEX} functions
3036 return the GNU C type @code{complex} (or its @code{struct}
3039 This does not affect the generation of code that interfaces with the
3040 @code{libg2c} library.
3042 However, because the @code{libg2c} library uses @code{f2c}
3043 calling conventions, @code{g77} rejects attempts to pass
3044 intrinsics implemented by routines in this library as actual
3045 arguments when @samp{-fno-f2c} is used, to avoid bugs when
3046 they are actually called by code expecting the GNU calling
3047 conventions to work.
3049 For example, @samp{INTRINSIC ABS;CALL FOO(ABS)} is
3050 rejected when @samp{-fno-f2c} is in force.
3051 (Future versions of the @code{g77} run-time library might
3052 offer routines that provide GNU-callable versions of the
3053 routines that implement the @code{f2c}-callable intrinsics
3054 that may be passed as actual arguments, so that
3055 valid programs need not be rejected when @samp{-fno-f2c}
3058 @strong{Caution:} If @samp{-fno-f2c} is used when compiling any
3059 source file used in a program, it must be used when compiling
3060 @emph{all} Fortran source files used in that program.
3062 @c seems kinda dumb to tell people about an option they can't use -- jcb
3063 @c then again, we want users building future-compatible libraries with it.
3064 @cindex -ff2c-library option
3065 @cindex options, -ff2c-library
3067 Specify that use of @code{libg2c} (or the original @code{libf2c})
3069 This is the default for the current version of @code{g77}.
3072 valid to specify @samp{-fno-f2c-library}.
3073 This option is provided so users can specify it in shell
3074 scripts that build programs and libraries that require the
3075 @code{libf2c} library, even when being compiled by future
3076 versions of @code{g77} that might otherwise default to
3077 generating code for an incompatible library.
3079 @cindex -fno-underscoring option
3080 @cindex options, -fno-underscoring
3081 @item -fno-underscoring
3083 @cindex symbol names, underscores
3084 @cindex transforming symbol names
3085 @cindex symbol names, transforming
3086 Do not transform names of entities specified in the Fortran
3087 source file by appending underscores to them.
3089 With @samp{-funderscoring} in effect, @code{g77} appends two underscores
3090 to names with underscores and one underscore to external names with
3091 no underscores. (@code{g77} also appends two underscores to internal
3092 names with underscores to avoid naming collisions with external names.
3093 The @samp{-fno-second-underscore} option disables appending of the
3094 second underscore in all cases.)
3096 This is done to ensure compatibility with code produced by many
3097 UNIX Fortran compilers, including @code{f2c}, which perform the
3098 same transformations.
3100 Use of @samp{-fno-underscoring} is not recommended unless you are
3101 experimenting with issues such as integration of (GNU) Fortran into
3102 existing system environments (vis-a-vis existing libraries, tools, and
3105 For example, with @samp{-funderscoring}, and assuming other defaults like
3106 @samp{-fcase-lower} and that @samp{j()} and @samp{max_count()} are
3107 external functions while @samp{my_var} and @samp{lvar} are local variables,
3111 I = J() + MAX_COUNT (MY_VAR, LVAR)
3115 is implemented as something akin to:
3118 i = j_() + max_count__(&my_var__, &lvar);
3121 With @samp{-fno-underscoring}, the same statement is implemented as:
3124 i = j() + max_count(&my_var, &lvar);
3127 Use of @samp{-fno-underscoring} allows direct specification of
3128 user-defined names while debugging and when interfacing @code{g77}-compiled
3129 code with other languages.
3131 Note that just because the names match does @emph{not} mean that the
3132 interface implemented by @code{g77} for an external name matches the
3133 interface implemented by some other language for that same name.
3134 That is, getting code produced by @code{g77} to link to code produced
3135 by some other compiler using this or any other method can be only a
3136 small part of the overall solution---getting the code generated by
3137 both compilers to agree on issues other than naming can require
3138 significant effort, and, unlike naming disagreements, linkers normally
3139 cannot detect disagreements in these other areas.
3141 Also, note that with @samp{-fno-underscoring}, the lack of appended
3142 underscores introduces the very real possibility that a user-defined
3143 external name will conflict with a name in a system library, which
3144 could make finding unresolved-reference bugs quite difficult in some
3145 cases---they might occur at program run time, and show up only as
3146 buggy behavior at run time.
3148 In future versions of @code{g77}, we hope to improve naming and linking
3149 issues so that debugging always involves using the names as they appear
3150 in the source, even if the names as seen by the linker are mangled to
3151 prevent accidental linking between procedures with incompatible
3154 @cindex -fno-second-underscore option
3155 @cindex options, -fno-second-underscore
3156 @item -fno-second-underscore
3158 @cindex symbol names, underscores
3159 @cindex transforming symbol names
3160 @cindex symbol names, transforming
3161 Do not append a second underscore to names of entities specified
3162 in the Fortran source file.
3164 This option has no effect if @samp{-fno-underscoring} is
3167 Otherwise, with this option, an external name such as @samp{MAX_COUNT}
3168 is implemented as a reference to the link-time external symbol
3169 @samp{max_count_}, instead of @samp{max_count__}.
3171 @cindex -fno-ident option
3172 @cindex options, -fno-ident
3174 Ignore the @samp{#ident} directive.
3176 @cindex -fzeros option
3177 @cindex options, -fzeros
3179 Treat initial values of zero as if they were any other value.
3181 As of version 0.5.18, @code{g77} normally treats @code{DATA} and
3182 other statements that are used to specify initial values of zero
3183 for variables and arrays as if no values were actually specified,
3184 in the sense that no diagnostics regarding multiple initializations
3187 This is done to speed up compiling of programs that initialize
3188 large arrays to zeros.
3190 Use @samp{-fzeros} to revert to the simpler, slower behavior
3191 that can catch multiple initializations by keeping track of
3192 all initializations, zero or otherwise.
3194 @emph{Caution:} Future versions of @code{g77} might disregard this option
3195 (and its negative form, the default) or interpret it somewhat
3197 The interpretation changes will affect only non-standard
3198 programs; standard-conforming programs should not be affected.
3200 @cindex -fdebug-kludge option
3201 @cindex options, -fdebug-kludge
3202 @item -fdebug-kludge
3203 Emit information on @code{COMMON} and @code{EQUIVALENCE} members
3204 that might help users of debuggers work around lack of proper debugging
3205 information on such members.
3207 As of version 0.5.19, @code{g77} offers this option to emit
3208 information on members of aggregate areas to help users while debugging.
3209 This information consists of establishing the type and contents of each
3210 such member so that, when a debugger is asked to print the contents,
3211 the printed information provides rudimentary debugging information.
3212 This information identifies the name of the aggregate area (either the
3213 @code{COMMON} block name, or the @code{g77}-assigned name for the
3214 @code{EQUIVALENCE} name) and the offset, in bytes, of the member from
3215 the beginning of the area.
3217 Using @code{gdb}, this information is not coherently displayed in the Fortran
3218 language mode, so temporarily switching to the C language mode to display the
3219 information is suggested.
3220 Use @samp{set language c} and @samp{set language fortran} to accomplish this.
3222 As of version 0.5.26 of @code{g77} this option has been disabled, as the
3223 compiler is now able to emit correct and complete debug information
3224 for COMMON BLOCK and EQUIVALENCE items.
3232 EQUIVALENCE (I,XX(20:20))
3235 GDB is free software and you are welcome to distribute copies of it
3236 under certain conditions; type "show copying" to see the conditions.
3237 There is absolutely no warranty for GDB; type "show warranty" for details.
3238 GDB 4.16 (lm-gnits-dwim), Copyright 1996 Free Software Foundation, Inc...
3240 Breakpoint 1 at 0t1200000201120112: file cd.f, line 5.
3242 Starting program: /home/user/a.out
3244 Breakpoint 1, MAIN__ () at cd.f:5
3245 Current language: auto; currently fortran
3246 (gdb) set language c
3247 Warning: the current language does not match this frame.
3249 $2 = "At (COMMON) `x_' plus 0 bytes"
3251 $3 = "At (COMMON) `x_' plus 4 bytes"
3253 $4 = "At (EQUIVALENCE) `__g77_equiv_c' plus 0 bytes"
3255 $5 = "At (EQUIVALENCE) `__g77_equiv_c' plus 0 bytes"
3257 $6 = "At (EQUIVALENCE) `__g77_equiv_xx' plus 20 bytes"
3259 $7 = "At (EQUIVALENCE) `__g77_equiv_xx' plus 1 bytes"
3260 (gdb) set language fortran
3265 Use @samp{-fdebug-kludge} to generate this information,
3266 which might make some programs noticeably larger.
3268 @emph{Caution:} Future versions of @code{g77} might disregard this option
3269 (and its negative form).
3270 Current plans call for this to happen when published versions of @code{g77}
3271 and @code{gdb} exist that provide proper access to debugging information on
3272 @code{COMMON} and @code{EQUIVALENCE} members. This is believed to have
3273 happened as of version 0.5.26 of @code{g77}, so that this option has been
3274 disabled starting with this release.
3276 @cindex -femulate-complex option
3277 @cindex options, -femulate-complex
3278 @item -femulate-complex
3279 Implement @code{COMPLEX} arithmetic via emulation,
3280 instead of using the facilities of
3281 the @code{gcc} back end that provide direct support of
3282 @code{complex} arithmetic.
3284 (@code{gcc} had some bugs in its back-end support
3285 for @code{complex} arithmetic, due primarily to the support not being
3286 completed as of version 2.8.1 and @code{egcs} 1.1.2.)
3288 Use @samp{-femulate-complex} if you suspect code-generation bugs,
3289 or experience compiler crashes,
3290 that might result from @code{g77} using the @code{COMPLEX} support
3291 in the @code{gcc} back end.
3292 If using that option fixes the bugs or crashes you are seeing,
3293 that indicates a likely @code{g77} bugs
3294 (though, all compiler crashes are considered bugs),
3295 so, please report it.
3296 (Note that the known bugs, now believed fixed, produced compiler crashes
3297 rather than causing the generation of incorrect code.)
3299 Use of this option should not affect how Fortran code compiled
3300 by @code{g77} works in terms of its interfaces to other code,
3301 e.g. that compiled by @code{f2c}.
3303 @emph{Caution:} Future versions of @code{g77} might ignore both forms
3306 @cindex -falias-check option
3307 @cindex options, -falias-check
3308 @cindex -fargument-alias option
3309 @cindex options, -fargument-alias
3310 @cindex -fargument-noalias option
3311 @cindex options, -fargument-noalias
3312 @cindex -fno-argument-noalias-global option
3313 @cindex options, -fno-argument-noalias-global
3315 @item -fargument-alias
3316 @item -fargument-noalias
3317 @item -fno-argument-noalias-global
3318 @emph{Version info:}
3319 These options are not supported by
3320 versions of @code{g77} based on @code{gcc} version 2.8.
3322 These options specify to what degree aliasing
3324 is permitted between
3325 arguments (passed as pointers) and @code{COMMON} (external, or
3328 The default for Fortran code, as mandated by the FORTRAN 77 and
3329 Fortran 90 standards, is @samp{-fargument-noalias-global}.
3330 The default for code written in the C language family is
3331 @samp{-fargument-alias}.
3333 Note that, on some systems, compiling with @samp{-fforce-addr} in
3334 effect can produce more optimal code when the default aliasing
3335 options are in effect (and when optimization is enabled).
3337 @xref{Aliasing Assumed To Work}, for detailed information on the implications
3338 of compiling Fortran code that depends on the ability to alias dummy
3341 @cindex -fno-globals option
3342 @cindex options, -fno-globals
3344 @cindex global names, warning
3345 @cindex warnings, global names
3346 @cindex in-line code
3347 @cindex compilation, in-line
3348 Disable diagnostics about inter-procedural
3349 analysis problems, such as disagreements about the
3350 type of a function or a procedure's argument,
3351 that might cause a compiler crash when attempting
3352 to inline a reference to a procedure within a
3354 (The diagnostics themselves are still produced, but
3355 as warnings, unless @samp{-Wno-globals} is specified,
3356 in which case no relevant diagnostics are produced.)
3358 Further, this option disables such inlining, to
3359 avoid compiler crashes resulting from incorrect
3360 code that would otherwise be diagnosed.
3362 As such, this option might be quite useful when
3363 compiling existing, ``working'' code that happens
3364 to have a few bugs that do not generally show themselves,
3365 but which @code{g77} diagnoses.
3367 Use of this option therefore has the effect of
3368 instructing @code{g77} to behave more like it did
3369 up through version 0.5.19.1, when it paid little or
3370 no attention to disagreements between program units
3371 about a procedure's type and argument information,
3372 and when it performed no inlining of procedures
3373 (except statement functions).
3375 Without this option, @code{g77} defaults to performing
3376 the potentially inlining procedures as it started doing
3377 in version 0.5.20, but as of version 0.5.21, it also
3378 diagnoses disagreements that might cause such inlining
3379 to crash the compiler as (fatal) errors,
3380 and warns about similar disagreements
3381 that are currently believed to not
3382 likely to result in the compiler later crashing
3383 or producing incorrect code.
3385 @cindex -fflatten-arrays option
3386 @item -fflatten-arrays
3387 @cindex array performance
3388 @cindex arrays, flattening
3389 Use back end's C-like constructs
3390 (pointer plus offset)
3391 instead of its @code{ARRAY_REF} construct
3392 to handle all array references.
3394 @emph{Note:} This option is not supported.
3395 It is intended for use only by @code{g77} developers,
3396 to evaluate code-generation issues.
3397 It might be removed at any time.
3399 @cindex -fbounds-check option
3400 @cindex -ffortran-bounds-check option
3401 @item -fbounds-check
3402 @itemx -ffortran-bounds-check
3403 @cindex bounds checking
3404 @cindex range checking
3405 @cindex array bounds checking
3406 @cindex subscript checking
3407 @cindex substring checking
3408 @cindex checking subscripts
3409 @cindex checking substrings
3410 Enable generation of run-time checks for array subscripts
3411 and substring start and end points
3412 against the (locally) declared minimum and maximum values.
3414 The current implementation uses the @code{libf2c}
3415 library routine @code{s_rnge} to print the diagnostic.
3417 However, whereas @code{f2c} generates a single check per
3418 reference for a multi-dimensional array, of the computed
3419 offset against the valid offset range (0 through the size of the array),
3420 @code{g77} generates a single check per @emph{subscript} expression.
3421 This catches some cases of potential bugs that @code{f2c} does not,
3422 such as references to below the beginning of an assumed-size array.
3424 @code{g77} also generates checks for @code{CHARACTER} substring references,
3425 something @code{f2c} currently does not do.
3427 Use the new @samp{-ffortran-bounds-check} option
3428 to specify bounds-checking for only the Fortran code you are compiling,
3429 not necessarily for code written in other languages.
3431 @emph{Note:} To provide more detailed information on the offending subscript,
3432 @code{g77} provides the @code{libg2c} run-time library routine @code{s_rnge}
3433 with somewhat differently-formatted information.
3434 Here's a sample diagnostic:
3437 Subscript out of range on file line 4, procedure rnge.f/bf.
3438 Attempt to access the -6-th element of variable b[subscript-2-of-2].
3442 The above message indicates that the offending source line is
3443 line 4 of the file @file{rnge.f},
3444 within the program unit (or statement function) named @samp{bf}.
3445 The offended array is named @samp{b}.
3446 The offended array dimension is the second for a two-dimensional array,
3447 and the offending, computed subscript expression was @samp{-6}.
3449 For a @code{CHARACTER} substring reference, the second line has
3453 Attempt to access the 11-th element of variable a[start-substring].
3456 This indicates that the offended @code{CHARACTER} variable or array
3458 the offended substring position is the starting (leftmost) position,
3459 and the offending substring expression is @samp{11}.
3461 (Though the verbage of @code{s_rnge} is not ideal
3462 for the purpose of the @code{g77} compiler,
3463 the above information should provide adequate diagnostic abilities
3467 @xref{Code Gen Options,,Options for Code Generation Conventions,
3468 gcc,Using and Porting GNU CC}, for information on more options
3470 shared by @code{g77}, @code{gcc}, and other GNU compilers.
3472 Some of these do @emph{not} work when compiling programs written in Fortran:
3475 @cindex -fpcc-struct-return option
3476 @cindex options, -fpcc-struct-return
3477 @item -fpcc-struct-return
3478 @cindex -freg-struct-return option
3479 @cindex options, -freg-struct-return
3480 @item -freg-struct-return
3481 You should not use these except strictly the same way as you
3482 used them to build the version of @code{libg2c} with which
3483 you will be linking all code compiled by @code{g77} with the
3486 @cindex -fshort-double option
3487 @cindex options, -fshort-double
3488 @item -fshort-double
3489 This probably either has no effect on Fortran programs, or
3490 makes them act loopy.
3492 @cindex -fno-common option
3493 @cindex options, -fno-common
3495 Do not use this when compiling Fortran programs,
3496 or there will be Trouble.
3498 @cindex -fpack-struct option
3499 @cindex options, -fpack-struct
3501 This probably will break any calls to the @code{libg2c} library,
3502 at the very least, even if it is built with the same option.
3505 @node Environment Variables
3506 @section Environment Variables Affecting GNU Fortran
3507 @cindex environment variables
3509 GNU Fortran currently does not make use of any environment
3510 variables to control its operation above and beyond those
3511 that affect the operation of @code{gcc}.
3513 @xref{Environment Variables,,Environment Variables Affecting GNU CC,
3514 gcc,Using and Porting GNU CC}, for information on environment
3524 @chapter The GNU Fortran Language
3526 @cindex standard, ANSI FORTRAN 77
3527 @cindex ANSI FORTRAN 77 standard
3528 @cindex reference works
3529 GNU Fortran supports a variety of extensions to, and dialects
3530 of, the Fortran language.
3531 Its primary base is the ANSI FORTRAN 77 standard, currently available on
3533 @uref{http://www.fortran.com/fortran/F77_std/rjcnf0001.html}
3534 or as monolithic text at
3535 @uref{http://www.fortran.com/fortran/F77_std/f77_std.html}.
3536 It offers some extensions that are popular among users
3537 of UNIX @code{f77} and @code{f2c} compilers, some that
3538 are popular among users of other compilers (such as Digital
3539 products), some that are popular among users of the
3540 newer Fortran 90 standard, and some that are introduced
3544 (If you need a text on Fortran,
3545 a few freely available electronic references have pointers from
3546 @uref{http://www.fortran.com/fortran/Books/}. There is a `cooperative
3547 net project', @cite{User Notes on Fortran Programming} at
3548 @uref{ftp://vms.huji.ac.il/fortran/} and mirrors elsewhere; some of this
3549 material might not apply specifically to @code{g77}.)
3551 Part of what defines a particular implementation of a Fortran
3552 system, such as @code{g77}, is the particular characteristics
3553 of how it supports types, constants, and so on.
3554 Much of this is left up to the implementation by the various
3555 Fortran standards and accepted practice in the industry.
3557 The GNU Fortran @emph{language} is described below.
3558 Much of the material is organized along the same lines
3559 as the ANSI FORTRAN 77 standard itself.
3561 @xref{Other Dialects}, for information on features @code{g77} supports
3562 that are not part of the GNU Fortran language.
3564 @emph{Note}: This portion of the documentation definitely needs a lot
3568 Relationship to the ANSI FORTRAN 77 standard:
3569 * Direction of Language Development:: Where GNU Fortran is headed.
3570 * Standard Support:: Degree of support for the standard.
3572 Extensions to the ANSI FORTRAN 77 standard:
3575 * Terms and Concepts::
3576 * Characters Lines Sequence::
3577 * Data Types and Constants::
3579 * Specification Statements::
3580 * Control Statements::
3581 * Functions and Subroutines::
3582 * Scope and Classes of Names::
3584 * Fortran 90 Features::
3587 @node Direction of Language Development
3588 @section Direction of Language Development
3589 @cindex direction of language development
3590 @cindex features, language
3591 @cindex language, features
3593 The purpose of the following description of the GNU Fortran
3594 language is to promote wide portability of GNU Fortran programs.
3596 GNU Fortran is an evolving language, due to the
3597 fact that @code{g77} itself is in beta test.
3598 Some current features of the language might later
3599 be redefined as dialects of Fortran supported by @code{g77}
3600 when better ways to express these features are added to @code{g77},
3602 Such features would still be supported by
3603 @code{g77}, but would be available only when
3604 one or more command-line options were used.
3606 The GNU Fortran @emph{language} is distinct from the
3607 GNU Fortran @emph{compilation system} (@code{g77}).
3609 For example, @code{g77} supports various dialects of
3610 Fortran---in a sense, these are languages other than
3611 GNU Fortran---though its primary
3612 purpose is to support the GNU Fortran language, which also is
3613 described in its documentation and by its implementation.
3615 On the other hand, non-GNU compilers might offer
3616 support for the GNU Fortran language, and are encouraged
3619 Currently, the GNU Fortran language is a fairly fuzzy object.
3620 It represents something of a cross between what @code{g77} accepts
3621 when compiling using the prevailing defaults and what this
3622 document describes as being part of the language.
3624 Future versions of @code{g77} are expected to clarify the
3625 definition of the language in the documentation.
3626 Often, this will mean adding new features to the language, in the form
3627 of both new documentation and new support in @code{g77}.
3628 However, it might occasionally mean removing a feature
3629 from the language itself to ``dialect'' status.
3630 In such a case, the documentation would be adjusted
3631 to reflect the change, and @code{g77} itself would likely be changed
3632 to require one or more command-line options to continue supporting
3635 The development of the GNU Fortran language is intended to strike
3640 Serving as a mostly-upwards-compatible language from the
3641 de facto UNIX Fortran dialect as supported by @code{f77}.
3644 Offering new, well-designed language features.
3645 Attributes of such features include
3646 not making existing code any harder to read
3647 (for those who might be unaware that the new
3648 features are not in use) and
3649 not making state-of-the-art
3650 compilers take longer to issue diagnostics,
3654 Supporting existing, well-written code without gratuitously
3655 rejecting non-standard constructs, regardless of the origin
3656 of the code (its dialect).
3659 Offering default behavior and command-line options to reduce
3660 and, where reasonable, eliminate the need for programmers to make
3661 any modifications to code that already works in existing
3662 production environments.
3665 Diagnosing constructs that have different meanings in different
3666 systems, languages, and dialects, while offering clear,
3667 less ambiguous ways to express each of the different meanings
3668 so programmers can change their code appropriately.
3671 One of the biggest practical challenges for the developers of the
3672 GNU Fortran language is meeting the sometimes contradictory demands
3675 For example, a feature might be widely used in one popular environment,
3676 but the exact same code that utilizes that feature might not work
3677 as expected---perhaps it might mean something entirely different---in
3678 another popular environment.
3680 Traditionally, Fortran compilers---even portable ones---have solved this
3681 problem by simply offering the appropriate feature to users of
3682 the respective systems.
3683 This approach treats users of various Fortran systems and dialects
3684 as remote ``islands'', or camps, of programmers, and assume that these
3685 camps rarely come into contact with each other (or,
3686 especially, with each other's code).
3688 Project GNU takes a radically different approach to software and language
3689 design, in that it assumes that users of GNU software do not necessarily
3690 care what kind of underlying system they are using, regardless
3691 of whether they are using software (at the user-interface
3692 level) or writing it (for example, writing Fortran or C code).
3694 As such, GNU users rarely need consider just what kind of underlying
3695 hardware (or, in many cases, operating system) they are using at any
3697 They can use and write software designed for a general-purpose,
3698 widely portable, heterogenous environment---the GNU environment.
3700 In line with this philosophy, GNU Fortran must evolve into a product
3701 that is widely ported and portable not only in the sense that it can
3702 be successfully built, installed, and run by users, but in the larger
3703 sense that its users can use it in the same way, and expect largely the
3704 same behaviors from it, regardless of the kind of system they are using
3705 at any particular time.
3707 This approach constrains the solutions @code{g77} can use to resolve
3708 conflicts between various camps of Fortran users.
3709 If these two camps disagree about what a particular construct should
3710 mean, @code{g77} cannot simply be changed to treat that particular construct as
3711 having one meaning without comment (such as a warning), lest the users
3712 expecting it to have the other meaning are unpleasantly surprised that
3713 their code misbehaves when executed.
3715 The use of the ASCII backslash character in character constants is
3716 an excellent (and still somewhat unresolved) example of this kind of
3718 @xref{Backslash in Constants}.
3719 Other examples are likely to arise in the future, as @code{g77} developers
3720 strive to improve its ability to accept an ever-wider variety of existing
3721 Fortran code without requiring significant modifications to said code.
3723 Development of GNU Fortran is further constrained by the desire
3724 to avoid requiring programmers to change their code.
3725 This is important because it allows programmers, administrators,
3726 and others to more faithfully evaluate and validate @code{g77}
3727 (as an overall product and as new versions are distributed)
3728 without having to support multiple versions of their programs
3729 so that they continue to work the same way on their existing
3730 systems (non-GNU perhaps, but possibly also earlier versions
3733 @node Standard Support
3734 @section ANSI FORTRAN 77 Standard Support
3735 @cindex ANSI FORTRAN 77 support
3736 @cindex standard, support for
3737 @cindex support, FORTRAN 77
3738 @cindex compatibility, FORTRAN 77
3739 @cindex FORTRAN 77 compatibility
3741 GNU Fortran supports ANSI FORTRAN 77 with the following caveats.