OSDN Git Service

2008-12-21 Arjen Markus <arjen.markus@wldelft.nl>
[pf3gnuchains/gcc-fork.git] / gcc / fortran / gfortran.texi
1 \input texinfo  @c -*-texinfo-*-
2 @c %**start of header
3 @setfilename gfortran.info
4 @set copyrights-gfortran 1999-2008
5
6 @include gcc-common.texi
7
8 @settitle The GNU Fortran Compiler
9
10 @c Create a separate index for command line options
11 @defcodeindex op
12 @c Merge the standard indexes into a single one.
13 @syncodeindex fn cp
14 @syncodeindex vr cp
15 @syncodeindex ky cp
16 @syncodeindex pg cp
17 @syncodeindex tp cp
18
19 @c TODO: The following "Part" definitions are included here temporarily
20 @c until they are incorporated into the official Texinfo distribution.
21 @c They borrow heavily from Texinfo's \unnchapentry definitions.
22
23 @tex
24 \gdef\part#1#2{%
25   \pchapsepmacro
26   \gdef\thischapter{}
27   \begingroup
28     \vglue\titlepagetopglue
29     \titlefonts \rm
30     \leftline{Part #1:@* #2}
31     \vskip4pt \hrule height 4pt width \hsize \vskip4pt
32   \endgroup
33   \writetocentry{part}{#2}{#1}
34 }
35 \gdef\blankpart{%
36   \writetocentry{blankpart}{}{}
37 }
38 % Part TOC-entry definition for summary contents.
39 \gdef\dosmallpartentry#1#2#3#4{%
40   \vskip .5\baselineskip plus.2\baselineskip
41   \begingroup
42     \let\rm=\bf \rm
43     \tocentry{Part #2: #1}{\doshortpageno\bgroup#4\egroup}
44   \endgroup
45 }
46 \gdef\dosmallblankpartentry#1#2#3#4{%
47   \vskip .5\baselineskip plus.2\baselineskip
48 }
49 % Part TOC-entry definition for regular contents.  This has to be
50 % equated to an existing entry to not cause problems when the PDF
51 % outline is created.
52 \gdef\dopartentry#1#2#3#4{%
53   \unnchapentry{Part #2: #1}{}{#3}{#4}
54 }
55 \gdef\doblankpartentry#1#2#3#4{}
56 @end tex
57
58 @c %**end of header
59
60 @c Use with @@smallbook.
61
62 @c %** start of document
63
64 @c Cause even numbered pages to be printed on the left hand side of
65 @c the page and odd numbered pages to be printed on the right hand
66 @c side of the page.  Using this, you can print on both sides of a
67 @c sheet of paper and have the text on the same part of the sheet.
68
69 @c The text on right hand pages is pushed towards the right hand
70 @c margin and the text on left hand pages is pushed toward the left
71 @c hand margin.
72 @c (To provide the reverse effect, set bindingoffset to -0.75in.)
73
74 @c @tex
75 @c \global\bindingoffset=0.75in
76 @c \global\normaloffset =0.75in
77 @c @end tex
78
79 @copying
80 Copyright @copyright{} @value{copyrights-gfortran} Free Software Foundation, Inc.
81
82 Permission is granted to copy, distribute and/or modify this document
83 under the terms of the GNU Free Documentation License, Version 1.2 or
84 any later version published by the Free Software Foundation; with the
85 Invariant Sections being ``Funding Free Software'', the Front-Cover
86 Texts being (a) (see below), and with the Back-Cover Texts being (b)
87 (see below).  A copy of the license is included in the section entitled
88 ``GNU Free Documentation License''.
89
90 (a) The FSF's Front-Cover Text is:
91
92      A GNU Manual
93
94 (b) The FSF's Back-Cover Text is:
95
96      You have freedom to copy and modify this GNU Manual, like GNU
97      software.  Copies published by the Free Software Foundation raise
98      funds for GNU development.
99 @end copying
100
101 @ifinfo
102 @dircategory Software development
103 @direntry
104 * gfortran: (gfortran).                  The GNU Fortran Compiler.
105 @end direntry
106 This file documents the use and the internals of
107 the GNU Fortran compiler, (@command{gfortran}).
108
109 Published by the Free Software Foundation
110 51 Franklin Street, Fifth Floor
111 Boston, MA 02110-1301 USA
112
113 @insertcopying
114 @end ifinfo
115
116
117 @setchapternewpage odd
118 @titlepage
119 @title Using GNU Fortran
120 @versionsubtitle
121 @author The @t{gfortran} team
122 @page
123 @vskip 0pt plus 1filll
124 Published by the Free Software Foundation@*
125 51 Franklin Street, Fifth Floor@*
126 Boston, MA 02110-1301, USA@*
127 @c Last printed ??ber, 19??.@*
128 @c Printed copies are available for $? each.@*
129 @c ISBN ???
130 @sp 1
131 @insertcopying
132 @end titlepage
133
134 @c TODO: The following "Part" definitions are included here temporarily
135 @c until they are incorporated into the official Texinfo distribution.
136
137 @tex
138 \global\let\partentry=\dosmallpartentry
139 \global\let\blankpartentry=\dosmallblankpartentry
140 @end tex
141 @summarycontents
142
143 @tex
144 \global\let\partentry=\dopartentry
145 \global\let\blankpartentry=\doblankpartentry
146 @end tex
147 @contents
148
149 @page
150
151 @c ---------------------------------------------------------------------
152 @c TexInfo table of contents.
153 @c ---------------------------------------------------------------------
154
155 @ifnottex
156 @node Top
157 @top Introduction
158 @cindex Introduction
159
160 This manual documents the use of @command{gfortran}, 
161 the GNU Fortran compiler. You can find in this manual how to invoke
162 @command{gfortran}, as well as its features and incompatibilities.
163
164 @ifset DEVELOPMENT
165 @emph{Warning:} This document, and the compiler it describes, are still
166 under development.  While efforts are made to keep it up-to-date, it might
167 not accurately reflect the status of the most recent GNU Fortran compiler.
168 @end ifset
169
170 @comment
171 @comment  When you add a new menu item, please keep the right hand
172 @comment  aligned to the same column.  Do not use tabs.  This provides
173 @comment  better formatting.
174 @comment
175 @menu
176 * Introduction::
177
178 Part I: Invoking GNU Fortran
179 * Invoking GNU Fortran:: Command options supported by @command{gfortran}.
180 * Runtime::              Influencing runtime behavior with environment variables.
181
182 Part II: Language Reference
183 * Fortran 2003 and 2008 status::  Fortran 2003 and 2008 features supported by GNU Fortran.
184 * Extensions::           Language extensions implemented by GNU Fortran.
185 * Intrinsic Procedures:: Intrinsic procedures supported by GNU Fortran.
186 * Intrinsic Modules::    Intrinsic modules supported by GNU Fortran.
187
188 * Contributing::         How you can help.
189 * Copying::              GNU General Public License says
190                          how you can copy and share GNU Fortran.
191 * GNU Free Documentation License::
192                          How you can copy and share this manual.
193 * Funding::              How to help assure continued work for free software.
194 * Option Index::         Index of command line options
195 * Keyword Index::        Index of concepts
196 @end menu
197 @end ifnottex
198
199 @c ---------------------------------------------------------------------
200 @c Introduction
201 @c ---------------------------------------------------------------------
202
203 @node Introduction
204 @chapter Introduction
205
206 @c The following duplicates the text on the TexInfo table of contents.
207 @iftex
208 This manual documents the use of @command{gfortran}, the GNU Fortran
209 compiler. You can find in this manual how to invoke @command{gfortran},
210 as well as its features and incompatibilities.
211
212 @ifset DEVELOPMENT
213 @emph{Warning:} This document, and the compiler it describes, are still
214 under development.  While efforts are made to keep it up-to-date, it
215 might not accurately reflect the status of the most recent GNU Fortran
216 compiler.
217 @end ifset
218 @end iftex
219
220 The GNU Fortran compiler front end was
221 designed initially as a free replacement for,
222 or alternative to, the unix @command{f95} command;
223 @command{gfortran} is the command you'll use to invoke the compiler.
224
225 @menu
226 * About GNU Fortran::    What you should know about the GNU Fortran compiler.
227 * GNU Fortran and GCC::  You can compile Fortran, C, or other programs.
228 * Preprocessing and conditional compilation:: The Fortran preprocessor
229 * GNU Fortran and G77::  Why we chose to start from scratch.
230 * Project Status::       Status of GNU Fortran, roadmap, proposed extensions.
231 * Standards::            Standards supported by GNU Fortran.
232 @end menu
233
234
235 @c ---------------------------------------------------------------------
236 @c About GNU Fortran
237 @c ---------------------------------------------------------------------
238
239 @node About GNU Fortran
240 @section About GNU Fortran
241
242 The GNU Fortran compiler is still in an early state of development.
243 It can generate code for most constructs and expressions,
244 but much work remains to be done.
245
246 When the GNU Fortran compiler is finished,
247 it will do everything you expect from any decent compiler: 
248
249 @itemize @bullet
250 @item
251 Read a user's program,
252 stored in a file and containing instructions written
253 in Fortran 77, Fortran 90, Fortran 95, Fortran 2003 or Fortran 2008.
254 This file contains @dfn{source code}.
255
256 @item
257 Translate the user's program into instructions a computer
258 can carry out more quickly than it takes to translate the
259 instructions in the first
260 place.  The result after compilation of a program is
261 @dfn{machine code},
262 code designed to be efficiently translated and processed
263 by a machine such as your computer.
264 Humans usually aren't as good writing machine code
265 as they are at writing Fortran (or C++, Ada, or Java),
266 because it is easy to make tiny mistakes writing machine code.
267
268 @item
269 Provide the user with information about the reasons why
270 the compiler is unable to create a binary from the source code.
271 Usually this will be the case if the source code is flawed.
272 The Fortran 90 standard requires that the compiler can point out
273 mistakes to the user.
274 An incorrect usage of the language causes an @dfn{error message}.
275
276 The compiler will also attempt to diagnose cases where the
277 user's program contains a correct usage of the language,
278 but instructs the computer to do something questionable.
279 This kind of diagnostics message is called a @dfn{warning message}.
280
281 @item
282 Provide optional information about the translation passes
283 from the source code to machine code.
284 This can help a user of the compiler to find the cause of
285 certain bugs which may not be obvious in the source code,
286 but may be more easily found at a lower level compiler output.
287 It also helps developers to find bugs in the compiler itself.
288
289 @item
290 Provide information in the generated machine code that can
291 make it easier to find bugs in the program (using a debugging tool,
292 called a @dfn{debugger}, such as the GNU Debugger @command{gdb}). 
293
294 @item
295 Locate and gather machine code already generated to
296 perform actions requested by statements in the user's program.
297 This machine code is organized into @dfn{modules} and is located
298 and @dfn{linked} to the user program. 
299 @end itemize
300
301 The GNU Fortran compiler consists of several components:
302
303 @itemize @bullet
304 @item
305 A version of the @command{gcc} command
306 (which also might be installed as the system's @command{cc} command)
307 that also understands and accepts Fortran source code.
308 The @command{gcc} command is the @dfn{driver} program for
309 all the languages in the GNU Compiler Collection (GCC);
310 With @command{gcc},
311 you can compile the source code of any language for
312 which a front end is available in GCC.
313
314 @item
315 The @command{gfortran} command itself,
316 which also might be installed as the
317 system's @command{f95} command.
318 @command{gfortran} is just another driver program,
319 but specifically for the Fortran compiler only.
320 The difference with @command{gcc} is that @command{gfortran}
321 will automatically link the correct libraries to your program.
322
323 @item
324 A collection of run-time libraries.
325 These libraries contain the machine code needed to support
326 capabilities of the Fortran language that are not directly
327 provided by the machine code generated by the
328 @command{gfortran} compilation phase,
329 such as intrinsic functions and subroutines,
330 and routines for interaction with files and the operating system.
331 @c and mechanisms to spawn,
332 @c unleash and pause threads in parallelized code.
333
334 @item
335 The Fortran compiler itself, (@command{f951}).
336 This is the GNU Fortran parser and code generator,
337 linked to and interfaced with the GCC backend library.
338 @command{f951} ``translates'' the source code to
339 assembler code.  You would typically not use this
340 program directly;
341 instead, the @command{gcc} or @command{gfortran} driver
342 programs will call it for you.
343 @end itemize
344
345
346 @c ---------------------------------------------------------------------
347 @c GNU Fortran and GCC
348 @c ---------------------------------------------------------------------
349
350 @node GNU Fortran and GCC
351 @section GNU Fortran and GCC
352 @cindex GNU Compiler Collection
353 @cindex GCC
354
355 GNU Fortran is a part of GCC, the @dfn{GNU Compiler Collection}.  GCC
356 consists of a collection of front ends for various languages, which
357 translate the source code into a language-independent form called
358 @dfn{GENERIC}.  This is then processed by a common middle end which
359 provides optimization, and then passed to one of a collection of back
360 ends which generate code for different computer architectures and
361 operating systems.
362
363 Functionally, this is implemented with a driver program (@command{gcc})
364 which provides the command-line interface for the compiler.  It calls
365 the relevant compiler front-end program (e.g., @command{f951} for
366 Fortran) for each file in the source code, and then calls the assembler
367 and linker as appropriate to produce the compiled output. In a copy of
368 GCC which has been compiled with Fortran language support enabled,
369 @command{gcc} will recognize files with @file{.f}, @file{.for}, @file{.ftn},
370 @file{.f90}, @file{.f95}, @file{.f03} and @file{.f08} extensions as
371 Fortran source code, and compile it accordingly. A @command{gfortran}
372 driver program is also provided, which is identical to @command{gcc}
373 except that it automatically links the Fortran runtime libraries into the
374 compiled program.
375
376 Source files with @file{.f}, @file{.for}, @file{.fpp}, @file{.ftn}, @file{.F},
377 @file{.FOR}, @file{.FPP}, and @file{.FTN} extensions are treated as fixed form.
378 Source files with @file{.f90}, @file{.f95}, @file{.f03}, @file{.f08},
379 @file{.F90}, @file{.F95}, @file{.F03} and @file{.F08} extensions are
380 treated as free form.  The capitalized versions of either form are run
381 through preprocessing. Source files with the lower case @file{.fpp}
382 extension are also run through preprocessing.
383
384 This manual specifically documents the Fortran front end, which handles
385 the programming language's syntax and semantics.  The aspects of GCC
386 which relate to the optimization passes and the back-end code generation
387 are documented in the GCC manual; see 
388 @ref{Top,,Introduction,gcc,Using the GNU Compiler Collection (GCC)}.
389 The two manuals together provide a complete reference for the GNU
390 Fortran compiler.
391
392
393 @c ---------------------------------------------------------------------
394 @c Preprocessing and conditional compilation
395 @c ---------------------------------------------------------------------
396
397 @node Preprocessing and conditional compilation
398 @section Preprocessing and conditional compilation
399 @cindex CPP
400 @cindex FPP
401 @cindex Conditional compilation
402 @cindex Preprocessing
403 @cindex preprocessor, include file handling
404
405 Many Fortran compilers including GNU Fortran allow passing the source code
406 through a C preprocessor (CPP; sometimes also called the Fortran preprocessor,
407 FPP) to allow for conditional compilation. In the case of GNU Fortran,
408 this is the GNU C Preprocessor in the traditional mode. On systems with
409 case-preserving file names, the preprocessor is automatically invoked if the
410 filename extension is @code{.F}, @code{.FOR}, @code{.FTN}, @code{.fpp},
411 @code{.FPP}, @code{.F90}, @code{.F95}, @code{.F03} or @code{.F08}. To manually
412 invoke the preprocessor on any file, use @option{-cpp}, to disable
413 preprocessing on files where the preprocessor is run automatically, use
414 @option{-nocpp}.
415
416 If a preprocessed file includes another file with the Fortran @code{INCLUDE}
417 statement, the included file is not preprocessed. To preprocess included
418 files, use the equivalent preprocessor statement @code{#include}.
419
420 If GNU Fortran invokes the preprocessor, @code{__GFORTRAN__}
421 is defined and @code{__GNUC__}, @code{__GNUC_MINOR__} and
422 @code{__GNUC_PATCHLEVEL__} can be used to determine the version of the
423 compiler. See @ref{Top,,Overview,cpp,The C Preprocessor} for details.
424
425 While CPP is the de-facto standard for preprocessing Fortran code,
426 Part 3 of the Fortran 95 standard (ISO/IEC 1539-3:1998) defines
427 Conditional Compilation, which is not widely used and not directly
428 supported by the GNU Fortran compiler. You can use the program coco
429 to preprocess such files (@uref{http://users.erols.com/dnagle/coco.html}).
430
431
432 @c ---------------------------------------------------------------------
433 @c GNU Fortran and G77
434 @c ---------------------------------------------------------------------
435
436 @node GNU Fortran and G77
437 @section GNU Fortran and G77
438 @cindex Fortran 77
439 @cindex @command{g77}
440
441 The GNU Fortran compiler is the successor to @command{g77}, the Fortran 
442 77 front end included in GCC prior to version 4.  It is an entirely new 
443 program that has been designed to provide Fortran 95 support and 
444 extensibility for future Fortran language standards, as well as providing 
445 backwards compatibility for Fortran 77 and nearly all of the GNU language 
446 extensions supported by @command{g77}.
447
448
449 @c ---------------------------------------------------------------------
450 @c Project Status
451 @c ---------------------------------------------------------------------
452
453 @node Project Status
454 @section Project Status
455
456 @quotation
457 As soon as @command{gfortran} can parse all of the statements correctly,
458 it will be in the ``larva'' state.
459 When we generate code, the ``puppa'' state.
460 When @command{gfortran} is done,
461 we'll see if it will be a beautiful butterfly,
462 or just a big bug....
463
464 --Andy Vaught, April 2000
465 @end quotation
466
467 The start of the GNU Fortran 95 project was announced on
468 the GCC homepage in March 18, 2000
469 (even though Andy had already been working on it for a while,
470 of course).
471
472 The GNU Fortran compiler is able to compile nearly all
473 standard-compliant Fortran 95, Fortran 90, and Fortran 77 programs,
474 including a number of standard and non-standard extensions, and can be
475 used on real-world programs.  In particular, the supported extensions
476 include OpenMP, Cray-style pointers, and several Fortran 2003 and Fortran
477 2008 features such as enumeration, stream I/O, and some of the
478 enhancements to allocatable array support from TR 15581.  However, it is
479 still under development and has a few remaining rough edges.
480
481 At present, the GNU Fortran compiler passes the
482 @uref{http://www.fortran-2000.com/ArnaudRecipes/fcvs21_f95.html, 
483 NIST Fortran 77 Test Suite}, and produces acceptable results on the
484 @uref{http://www.netlib.org/lapack/faq.html#1.21, LAPACK Test Suite}.
485 It also provides respectable performance on 
486 the @uref{http://www.polyhedron.com/pb05.html, Polyhedron Fortran
487 compiler benchmarks} and the
488 @uref{http://www.llnl.gov/asci_benchmarks/asci/limited/lfk/README.html,
489 Livermore Fortran Kernels test}.  It has been used to compile a number of
490 large real-world programs, including
491 @uref{http://mysite.verizon.net/serveall/moene.pdf, the HIRLAM
492 weather-forecasting code} and
493 @uref{http://www.theochem.uwa.edu.au/tonto/, the Tonto quantum 
494 chemistry package}; see @url{http://gcc.gnu.org/wiki/GfortranApps} for an
495 extended list.
496
497 Among other things, the GNU Fortran compiler is intended as a replacement
498 for G77.  At this point, nearly all programs that could be compiled with
499 G77 can be compiled with GNU Fortran, although there are a few minor known
500 regressions.
501
502 The primary work remaining to be done on GNU Fortran falls into three
503 categories: bug fixing (primarily regarding the treatment of invalid code
504 and providing useful error messages), improving the compiler optimizations
505 and the performance of compiled code, and extending the compiler to support
506 future standards---in particular, Fortran 2003.
507
508
509 @c ---------------------------------------------------------------------
510 @c Standards
511 @c ---------------------------------------------------------------------
512
513 @node Standards
514 @section Standards
515 @cindex Standards
516
517 The GNU Fortran compiler implements
518 ISO/IEC 1539:1997 (Fortran 95).  As such, it can also compile essentially all
519 standard-compliant Fortran 90 and Fortran 77 programs.   It also supports
520 the ISO/IEC TR-15581 enhancements to allocatable arrays, and
521 the @uref{http://www.openmp.org/drupal/mp-documents/spec25.pdf,
522 OpenMP Application Program Interface v2.5} specification.
523
524 In the future, the GNU Fortran compiler will also support ISO/IEC
525 1539-1:2004 (Fortran 2003) and future Fortran standards. Partial support
526 of that standard is already provided; the current status of Fortran 2003
527 support is reported in the @ref{Fortran 2003 status} section of the
528 documentation.
529
530 The next version of the Fortran standard after Fortran 2003 is currently
531 being developed and the GNU Fortran compiler supports some of its new
532 features. This support is based on the latest draft of the standard
533 (available from @url{http://www.nag.co.uk/sc22wg5/}) and no guarantee of
534 future compatibility is made, as the final standard might differ from the
535 draft. For more information, see the @ref{Fortran 2008 status} section.
536
537
538 @c =====================================================================
539 @c PART I: INVOCATION REFERENCE
540 @c =====================================================================
541
542 @tex
543 \part{I}{Invoking GNU Fortran}
544 @end tex
545
546 @c ---------------------------------------------------------------------
547 @c Compiler Options
548 @c ---------------------------------------------------------------------
549
550 @include invoke.texi
551
552
553 @c ---------------------------------------------------------------------
554 @c Runtime
555 @c ---------------------------------------------------------------------
556
557 @node Runtime
558 @chapter Runtime:  Influencing runtime behavior with environment variables
559 @cindex environment variable
560
561 The behavior of the @command{gfortran} can be influenced by
562 environment variables.
563
564 Malformed environment variables are silently ignored.
565
566 @menu
567 * GFORTRAN_STDIN_UNIT:: Unit number for standard input
568 * GFORTRAN_STDOUT_UNIT:: Unit number for standard output
569 * GFORTRAN_STDERR_UNIT:: Unit number for standard error
570 * GFORTRAN_USE_STDERR:: Send library output to standard error
571 * GFORTRAN_TMPDIR:: Directory for scratch files
572 * GFORTRAN_UNBUFFERED_ALL:: Don't buffer I/O for all units.
573 * GFORTRAN_UNBUFFERED_PRECONNECTED:: Don't buffer I/O for preconnected units.
574 * GFORTRAN_SHOW_LOCUS::  Show location for runtime errors
575 * GFORTRAN_OPTIONAL_PLUS:: Print leading + where permitted
576 * GFORTRAN_DEFAULT_RECL:: Default record length for new files
577 * GFORTRAN_LIST_SEPARATOR::  Separator for list output
578 * GFORTRAN_CONVERT_UNIT::  Set endianness for unformatted I/O
579 * GFORTRAN_ERROR_DUMPCORE:: Dump core on run-time errors
580 * GFORTRAN_ERROR_BACKTRACE:: Show backtrace on run-time errors
581 @end menu
582
583 @node GFORTRAN_STDIN_UNIT
584 @section @env{GFORTRAN_STDIN_UNIT}---Unit number for standard input
585
586 This environment variable can be used to select the unit number
587 preconnected to standard input.  This must be a positive integer.
588 The default value is 5.
589
590 @node GFORTRAN_STDOUT_UNIT
591 @section @env{GFORTRAN_STDOUT_UNIT}---Unit number for standard output
592
593 This environment variable can be used to select the unit number
594 preconnected to standard output.  This must be a positive integer.
595 The default value is 6.
596
597 @node GFORTRAN_STDERR_UNIT
598 @section @env{GFORTRAN_STDERR_UNIT}---Unit number for standard error
599
600 This environment variable can be used to select the unit number
601 preconnected to standard error.  This must be a positive integer.
602 The default value is 0.
603
604 @node GFORTRAN_USE_STDERR
605 @section @env{GFORTRAN_USE_STDERR}---Send library output to standard error
606
607 This environment variable controls where library output is sent.
608 If the first letter is @samp{y}, @samp{Y} or @samp{1}, standard
609 error is used. If the first letter is @samp{n}, @samp{N} or
610 @samp{0}, standard output is used.
611
612 @node GFORTRAN_TMPDIR
613 @section @env{GFORTRAN_TMPDIR}---Directory for scratch files
614
615 This environment variable controls where scratch files are
616 created.  If this environment variable is missing,
617 GNU Fortran searches for the environment variable @env{TMP}.  If
618 this is also missing, the default is @file{/tmp}.
619
620 @node GFORTRAN_UNBUFFERED_ALL
621 @section @env{GFORTRAN_UNBUFFERED_ALL}---Don't buffer I/O on all units
622
623 This environment variable controls whether all I/O is unbuffered.  If
624 the first letter is @samp{y}, @samp{Y} or @samp{1}, all I/O is
625 unbuffered. This will slow down small sequential reads and writes.  If
626 the first letter is @samp{n}, @samp{N} or @samp{0}, I/O is buffered.
627 This is the default.
628
629 @node GFORTRAN_UNBUFFERED_PRECONNECTED
630 @section @env{GFORTRAN_UNBUFFERED_PRECONNECTED}---Don't buffer I/O on preconnected units
631
632 The environment variable named @env{GFORTRAN_UNBUFFERED_PRECONNECTED} controls
633 whether I/O on a preconnected unit (i.e.@: STDOUT or STDERR) is unbuffered.  If 
634 the first letter is @samp{y}, @samp{Y} or @samp{1}, I/O is unbuffered. This
635 will slow down small sequential reads and writes.  If the first letter
636 is @samp{n}, @samp{N} or @samp{0}, I/O is buffered.  This is the default.
637
638 @node GFORTRAN_SHOW_LOCUS
639 @section @env{GFORTRAN_SHOW_LOCUS}---Show location for runtime errors
640
641 If the first letter is @samp{y}, @samp{Y} or @samp{1}, filename and
642 line numbers for runtime errors are printed.  If the first letter is
643 @samp{n}, @samp{N} or @samp{0}, don't print filename and line numbers
644 for runtime errors. The default is to print the location.
645
646 @node GFORTRAN_OPTIONAL_PLUS
647 @section @env{GFORTRAN_OPTIONAL_PLUS}---Print leading + where permitted
648
649 If the first letter is @samp{y}, @samp{Y} or @samp{1},
650 a plus sign is printed
651 where permitted by the Fortran standard.  If the first letter
652 is @samp{n}, @samp{N} or @samp{0}, a plus sign is not printed
653 in most cases. Default is not to print plus signs.
654
655 @node GFORTRAN_DEFAULT_RECL
656 @section @env{GFORTRAN_DEFAULT_RECL}---Default record length for new files
657
658 This environment variable specifies the default record length, in
659 bytes, for files which are opened without a @code{RECL} tag in the
660 @code{OPEN} statement.  This must be a positive integer.  The
661 default value is 1073741824 bytes (1 GB).
662
663 @node GFORTRAN_LIST_SEPARATOR
664 @section @env{GFORTRAN_LIST_SEPARATOR}---Separator for list output
665
666 This environment variable specifies the separator when writing
667 list-directed output.  It may contain any number of spaces and
668 at most one comma.  If you specify this on the command line,
669 be sure to quote spaces, as in
670 @smallexample
671 $ GFORTRAN_LIST_SEPARATOR='  ,  ' ./a.out
672 @end smallexample
673 when @command{a.out} is the compiled Fortran program that you want to run.
674 Default is a single space.
675
676 @node GFORTRAN_CONVERT_UNIT
677 @section @env{GFORTRAN_CONVERT_UNIT}---Set endianness for unformatted I/O
678
679 By setting the @env{GFORTRAN_CONVERT_UNIT} variable, it is possible
680 to change the representation of data for unformatted files.
681 The syntax for the @env{GFORTRAN_CONVERT_UNIT} variable is:
682 @smallexample
683 GFORTRAN_CONVERT_UNIT: mode | mode ';' exception | exception ;
684 mode: 'native' | 'swap' | 'big_endian' | 'little_endian' ;
685 exception: mode ':' unit_list | unit_list ;
686 unit_list: unit_spec | unit_list unit_spec ;
687 unit_spec: INTEGER | INTEGER '-' INTEGER ;
688 @end smallexample
689 The variable consists of an optional default mode, followed by
690 a list of optional exceptions, which are separated by semicolons
691 from the preceding default and each other.  Each exception consists
692 of a format and a comma-separated list of units.  Valid values for
693 the modes are the same as for the @code{CONVERT} specifier:
694
695 @itemize @w{}
696 @item @code{NATIVE} Use the native format.  This is the default.
697 @item @code{SWAP} Swap between little- and big-endian.
698 @item @code{LITTLE_ENDIAN} Use the little-endian format
699 for unformatted files.
700 @item @code{BIG_ENDIAN} Use the big-endian format for unformatted files.
701 @end itemize
702 A missing mode for an exception is taken to mean @code{BIG_ENDIAN}.
703 Examples of values for @env{GFORTRAN_CONVERT_UNIT} are:
704 @itemize @w{}
705 @item @code{'big_endian'}  Do all unformatted I/O in big_endian mode.
706 @item @code{'little_endian;native:10-20,25'}  Do all unformatted I/O 
707 in little_endian mode, except for units 10 to 20 and 25, which are in
708 native format.
709 @item @code{'10-20'}  Units 10 to 20 are big-endian, the rest is native.
710 @end itemize
711
712 Setting the environment variables should be done on the command
713 line or via the @command{export}
714 command for @command{sh}-compatible shells and via @command{setenv}
715 for @command{csh}-compatible shells.
716
717 Example for @command{sh}:
718 @smallexample
719 $ gfortran foo.f90
720 $ GFORTRAN_CONVERT_UNIT='big_endian;native:10-20' ./a.out
721 @end smallexample
722
723 Example code for @command{csh}:
724 @smallexample
725 % gfortran foo.f90
726 % setenv GFORTRAN_CONVERT_UNIT 'big_endian;native:10-20'
727 % ./a.out
728 @end smallexample
729
730 Using anything but the native representation for unformatted data
731 carries a significant speed overhead.  If speed in this area matters
732 to you, it is best if you use this only for data that needs to be
733 portable.
734
735 @xref{CONVERT specifier}, for an alternative way to specify the
736 data representation for unformatted files.  @xref{Runtime Options}, for
737 setting a default data representation for the whole program.  The
738 @code{CONVERT} specifier overrides the @option{-fconvert} compile options.
739
740 @emph{Note that the values specified via the GFORTRAN_CONVERT_UNIT
741 environment variable will override the CONVERT specifier in the
742 open statement}.  This is to give control over data formats to
743 users who do not have the source code of their program available.
744
745 @node GFORTRAN_ERROR_DUMPCORE
746 @section @env{GFORTRAN_ERROR_DUMPCORE}---Dump core on run-time errors
747
748 If the @env{GFORTRAN_ERROR_DUMPCORE} variable is set to
749 @samp{y}, @samp{Y} or @samp{1} (only the first letter is relevant)
750 then library run-time errors cause core dumps. To disable the core
751 dumps, set the variable to @samp{n}, @samp{N}, @samp{0}. Default
752 is not to core dump unless the @option{-fdump-core} compile option
753 was used.
754
755 @node GFORTRAN_ERROR_BACKTRACE
756 @section @env{GFORTRAN_ERROR_BACKTRACE}---Show backtrace on run-time errors
757
758 If the @env{GFORTRAN_ERROR_BACKTRACE} variable is set to
759 @samp{y}, @samp{Y} or @samp{1} (only the first letter is relevant)
760 then a backtrace is printed when a run-time error occurs.
761 To disable the backtracing, set the variable to
762 @samp{n}, @samp{N}, @samp{0}. Default is not to print a backtrace
763 unless the @option{-fbacktrace} compile option
764 was used.
765
766 @c =====================================================================
767 @c PART II: LANGUAGE REFERENCE
768 @c =====================================================================
769
770 @tex
771 \part{II}{Language Reference}
772 @end tex
773
774 @c ---------------------------------------------------------------------
775 @c Fortran 2003 and 2008 Status
776 @c ---------------------------------------------------------------------
777
778 @node Fortran 2003 and 2008 status
779 @chapter Fortran 2003 and 2008 Status
780
781 @menu
782 * Fortran 2003 status::
783 * Fortran 2008 status::
784 @end menu
785
786 @node Fortran 2003 status
787 @section Fortran 2003 status
788
789 Although GNU Fortran focuses on implementing the Fortran 95
790 standard for the time being, a few Fortran 2003 features are currently
791 available.
792
793 @itemize
794 @item 
795 Intrinsics @code{command_argument_count}, @code{get_command},
796 @code{get_command_argument}, @code{get_environment_variable}, and
797 @code{move_alloc}.
798
799 @item 
800 @cindex array, constructors
801 @cindex @code{[...]}
802 Array constructors using square brackets. That is, @code{[...]} rather
803 than @code{(/.../)}.
804
805 @item
806 @cindex @code{FLUSH} statement
807 @cindex statement, @code{FLUSH}
808 @code{FLUSH} statement.
809
810 @item
811 @cindex @code{IOMSG=} specifier
812 @code{IOMSG=} specifier for I/O statements.
813
814 @item
815 @cindex @code{ENUM} statement
816 @cindex @code{ENUMERATOR} statement
817 @cindex statement, @code{ENUM}
818 @cindex statement, @code{ENUMERATOR}
819 @opindex @code{fshort-enums}
820 Support for the declaration of enumeration constants via the
821 @code{ENUM} and @code{ENUMERATOR} statements.  Interoperability with
822 @command{gcc} is guaranteed also for the case where the
823 @command{-fshort-enums} command line option is given.
824
825 @item
826 @cindex TR 15581
827 TR 15581:
828 @itemize
829 @item
830 @cindex @code{ALLOCATABLE} dummy arguments
831 @code{ALLOCATABLE} dummy arguments.
832 @item
833 @cindex @code{ALLOCATABLE} function results
834 @code{ALLOCATABLE} function results
835 @item
836 @cindex @code{ALLOCATABLE} components of derived types
837 @code{ALLOCATABLE} components of derived types
838 @end itemize
839
840 @item
841 @cindex @code{STREAM} I/O
842 @cindex @code{ACCESS='STREAM'} I/O
843 The @code{OPEN} statement supports the @code{ACCESS='STREAM'} specifier,
844 allowing I/O without any record structure.
845
846 @item
847 Namelist input/output for internal files.
848
849 @item
850 @cindex @code{PROTECTED} statement
851 @cindex statement, @code{PROTECTED}
852 The @code{PROTECTED} statement and attribute.
853
854 @item
855 @cindex @code{VALUE} statement
856 @cindex statement, @code{VALUE}
857 The @code{VALUE} statement and attribute.
858
859 @item
860 @cindex @code{VOLATILE} statement
861 @cindex statement, @code{VOLATILE}
862 The @code{VOLATILE} statement and attribute.
863
864 @item
865 @cindex @code{IMPORT} statement
866 @cindex statement, @code{IMPORT}
867 The @code{IMPORT} statement, allowing to import
868 host-associated derived types.
869
870 @item
871 @cindex @code{USE, INTRINSIC} statement
872 @cindex statement, @code{USE, INTRINSIC}
873 @cindex @code{ISO_FORTRAN_ENV} statement
874 @cindex statement, @code{ISO_FORTRAN_ENV}
875 @code{USE} statement with @code{INTRINSIC} and @code{NON_INTRINSIC}
876 attribute; supported intrinsic modules: @code{ISO_FORTRAN_ENV},
877 @code{OMP_LIB} and @code{OMP_LIB_KINDS}.
878
879 @item
880 Renaming of operators in the @code{USE} statement.
881
882 @item
883 @cindex ISO C Bindings
884 Interoperability with C (ISO C Bindings)
885
886 @item
887 BOZ as argument of INT, REAL, DBLE and CMPLX.
888
889 @end itemize
890
891
892 @node Fortran 2008 status
893 @section Fortran 2008 status
894
895 The next version of the Fortran standard after Fortran 2003 is currently
896 being worked on by the Working Group 5 of Sub-Committee 22 of the Joint
897 Technical Committee 1 of the International Organization for
898 Standardization (ISO) and the International Electrotechnical Commission
899 (IEC). This group is known at @uref{http://www.nag.co.uk/sc22wg5/, WG5}.
900 The next revision of the Fortran standard is informally referred to as
901 Fortran 2008, reflecting its planned release year. The GNU Fortran
902 compiler has support for some of the new features in Fortran 2008. This
903 support is based on the latest draft, available from
904 @url{http://www.nag.co.uk/sc22wg5/}. However, as the final standard may
905 differ from the drafts, no guarantee of backward compatibility can be
906 made and you should only use it for experimental purposes.
907
908 @c ---------------------------------------------------------------------
909 @c Extensions
910 @c ---------------------------------------------------------------------
911
912 @c Maybe this chapter should be merged with the 'Standards' section,
913 @c whenever that is written :-)
914
915 @node Extensions
916 @chapter Extensions
917 @cindex extensions
918
919 The two sections below detail the extensions to standard Fortran that are
920 implemented in GNU Fortran, as well as some of the popular or
921 historically important extensions that are not (or not yet) implemented.
922 For the latter case, we explain the alternatives available to GNU Fortran
923 users, including replacement by standard-conforming code or GNU
924 extensions.
925
926 @menu
927 * Extensions implemented in GNU Fortran::
928 * Extensions not implemented in GNU Fortran::
929 @end menu
930
931
932 @node Extensions implemented in GNU Fortran
933 @section Extensions implemented in GNU Fortran
934 @cindex extensions, implemented
935
936 GNU Fortran implements a number of extensions over standard
937 Fortran. This chapter contains information on their syntax and
938 meaning.  There are currently two categories of GNU Fortran
939 extensions, those that provide functionality beyond that provided
940 by any standard, and those that are supported by GNU Fortran
941 purely for backward compatibility with legacy compilers.  By default,
942 @option{-std=gnu} allows the compiler to accept both types of
943 extensions, but to warn about the use of the latter.  Specifying
944 either @option{-std=f95}, @option{-std=f2003} or @option{-std=f2008}
945 disables both types of extensions, and @option{-std=legacy} allows both
946 without warning.
947
948 @menu
949 * Old-style kind specifications::
950 * Old-style variable initialization::
951 * Extensions to namelist::
952 * X format descriptor without count field::
953 * Commas in FORMAT specifications::
954 * Missing period in FORMAT specifications::
955 * I/O item lists::
956 * BOZ literal constants::
957 * Real array indices::
958 * Unary operators::
959 * Implicitly convert LOGICAL and INTEGER values::
960 * Hollerith constants support::
961 * Cray pointers::
962 * CONVERT specifier::
963 * OpenMP::
964 * Argument list functions::
965 @end menu
966
967 @node Old-style kind specifications
968 @subsection Old-style kind specifications
969 @cindex kind, old-style
970
971 GNU Fortran allows old-style kind specifications in declarations. These
972 look like:
973 @smallexample
974       TYPESPEC*size x,y,z
975 @end smallexample
976 @noindent
977 where @code{TYPESPEC} is a basic type (@code{INTEGER}, @code{REAL},
978 etc.), and where @code{size} is a byte count corresponding to the
979 storage size of a valid kind for that type.  (For @code{COMPLEX}
980 variables, @code{size} is the total size of the real and imaginary
981 parts.)  The statement then declares @code{x}, @code{y} and @code{z} to
982 be of type @code{TYPESPEC} with the appropriate kind.  This is
983 equivalent to the standard-conforming declaration
984 @smallexample
985       TYPESPEC(k) x,y,z
986 @end smallexample
987 @noindent
988 where @code{k} is the kind parameter suitable for the intended precision.  As
989 kind parameters are implementation-dependent, use the @code{KIND},
990 @code{SELECTED_INT_KIND} and @code{SELECTED_REAL_KIND} intrinsics to retrieve
991 the correct value, for instance @code{REAL*8 x} can be replaced by:
992 @smallexample
993 INTEGER, PARAMETER :: dbl = KIND(1.0d0)
994 REAL(KIND=dbl) :: x
995 @end smallexample
996
997 @node Old-style variable initialization
998 @subsection Old-style variable initialization
999
1000 GNU Fortran allows old-style initialization of variables of the
1001 form:
1002 @smallexample
1003       INTEGER i/1/,j/2/
1004       REAL x(2,2) /3*0.,1./
1005 @end smallexample
1006 The syntax for the initializers is as for the @code{DATA} statement, but
1007 unlike in a @code{DATA} statement, an initializer only applies to the
1008 variable immediately preceding the initialization.  In other words,
1009 something like @code{INTEGER I,J/2,3/} is not valid.  This style of
1010 initialization is only allowed in declarations without double colons
1011 (@code{::}); the double colons were introduced in Fortran 90, which also
1012 introduced a standard syntax for initializing variables in type
1013 declarations.
1014
1015 Examples of standard-conforming code equivalent to the above example
1016 are:
1017 @smallexample
1018 ! Fortran 90
1019       INTEGER :: i = 1, j = 2
1020       REAL :: x(2,2) = RESHAPE((/0.,0.,0.,1./),SHAPE(x))
1021 ! Fortran 77
1022       INTEGER i, j
1023       REAL x(2,2)
1024       DATA i/1/, j/2/, x/3*0.,1./
1025 @end smallexample
1026
1027 Note that variables which are explicitly initialized in declarations
1028 or in @code{DATA} statements automatically acquire the @code{SAVE}
1029 attribute.
1030
1031 @node Extensions to namelist
1032 @subsection Extensions to namelist
1033 @cindex Namelist
1034
1035 GNU Fortran fully supports the Fortran 95 standard for namelist I/O
1036 including array qualifiers, substrings and fully qualified derived types.
1037 The output from a namelist write is compatible with namelist read.  The
1038 output has all names in upper case and indentation to column 1 after the
1039 namelist name.  Two extensions are permitted:
1040
1041 Old-style use of @samp{$} instead of @samp{&}
1042 @smallexample
1043 $MYNML
1044  X(:)%Y(2) = 1.0 2.0 3.0
1045  CH(1:4) = "abcd"
1046 $END
1047 @end smallexample
1048
1049 It should be noted that the default terminator is @samp{/} rather than
1050 @samp{&END}.
1051
1052 Querying of the namelist when inputting from stdin. After at least
1053 one space, entering @samp{?} sends to stdout the namelist name and the names of
1054 the variables in the namelist:
1055 @smallexample
1056  ?
1057
1058 &mynml
1059  x
1060  x%y
1061  ch
1062 &end
1063 @end smallexample
1064
1065 Entering @samp{=?} outputs the namelist to stdout, as if
1066 @code{WRITE(*,NML = mynml)} had been called:
1067 @smallexample
1068 =?
1069
1070 &MYNML
1071  X(1)%Y=  0.000000    ,  1.000000    ,  0.000000    ,
1072  X(2)%Y=  0.000000    ,  2.000000    ,  0.000000    ,
1073  X(3)%Y=  0.000000    ,  3.000000    ,  0.000000    ,
1074  CH=abcd,  /
1075 @end smallexample
1076
1077 To aid this dialog, when input is from stdin, errors send their
1078 messages to stderr and execution continues, even if @code{IOSTAT} is set.
1079
1080 @code{PRINT} namelist is permitted.  This causes an error if
1081 @option{-std=f95} is used.
1082 @smallexample
1083 PROGRAM test_print
1084   REAL, dimension (4)  ::  x = (/1.0, 2.0, 3.0, 4.0/)
1085   NAMELIST /mynml/ x
1086   PRINT mynml
1087 END PROGRAM test_print
1088 @end smallexample
1089
1090 Expanded namelist reads are permitted.  This causes an error if 
1091 @option{-std=f95} is used.  In the following example, the first element
1092 of the array will be given the value 0.00 and the two succeeding
1093 elements will be given the values 1.00 and 2.00.
1094 @smallexample
1095 &MYNML
1096   X(1,1) = 0.00 , 1.00 , 2.00
1097 /
1098 @end smallexample
1099
1100 @node X format descriptor without count field
1101 @subsection @code{X} format descriptor without count field
1102
1103 To support legacy codes, GNU Fortran permits the count field of the
1104 @code{X} edit descriptor in @code{FORMAT} statements to be omitted.
1105 When omitted, the count is implicitly assumed to be one.
1106
1107 @smallexample
1108        PRINT 10, 2, 3
1109 10     FORMAT (I1, X, I1)
1110 @end smallexample
1111
1112 @node Commas in FORMAT specifications
1113 @subsection Commas in @code{FORMAT} specifications
1114
1115 To support legacy codes, GNU Fortran allows the comma separator
1116 to be omitted immediately before and after character string edit
1117 descriptors in @code{FORMAT} statements.
1118
1119 @smallexample
1120        PRINT 10, 2, 3
1121 10     FORMAT ('FOO='I1' BAR='I2)
1122 @end smallexample
1123
1124
1125 @node Missing period in FORMAT specifications
1126 @subsection Missing period in @code{FORMAT} specifications
1127
1128 To support legacy codes, GNU Fortran allows missing periods in format
1129 specifications if and only if @option{-std=legacy} is given on the
1130 command line.  This is considered non-conforming code and is
1131 discouraged.
1132
1133 @smallexample
1134        REAL :: value
1135        READ(*,10) value
1136 10     FORMAT ('F4')
1137 @end smallexample
1138
1139 @node I/O item lists
1140 @subsection I/O item lists
1141 @cindex I/O item lists
1142
1143 To support legacy codes, GNU Fortran allows the input item list
1144 of the @code{READ} statement, and the output item lists of the
1145 @code{WRITE} and @code{PRINT} statements, to start with a comma.
1146
1147 @node BOZ literal constants
1148 @subsection BOZ literal constants
1149 @cindex BOZ literal constants
1150
1151 Besides decimal constants, Fortran also supports binary (@code{b}),
1152 octal (@code{o}) and hexadecimal (@code{z}) integer constants. The
1153 syntax is: @samp{prefix quote digits quote}, were the prefix is
1154 either @code{b}, @code{o} or @code{z}, quote is either @code{'} or
1155 @code{"} and the digits are for binary @code{0} or @code{1}, for
1156 octal between @code{0} and @code{7}, and for hexadecimal between
1157 @code{0} and @code{F}. (Example: @code{b'01011101'}.)
1158
1159 Up to Fortran 95, BOZ literals were only allowed to initialize
1160 integer variables in DATA statements. Since Fortran 2003 BOZ literals
1161 are also allowed as argument of @code{REAL}, @code{DBLE}, @code{INT}
1162 and @code{CMPLX}; the result is the same as if the integer BOZ
1163 literal had been converted by @code{TRANSFER} to, respectively,
1164 @code{real}, @code{double precision}, @code{integer} or @code{complex}.
1165 As GNU Fortran extension the intrinsic procedures @code{FLOAT},
1166 @code{DFLOAT}, @code{COMPLEX} and @code{DCMPLX} are treated alike.
1167
1168 As an extension, GNU Fortran allows hexadecimal BOZ literal constants to
1169 be specified using the @code{X} prefix, in addition to the standard
1170 @code{Z} prefix. The BOZ literal can also be specified by adding a
1171 suffix to the string, for example, @code{Z'ABC'} and @code{'ABC'Z} are
1172 equivalent.
1173
1174 Furthermore, GNU Fortran allows using BOZ literal constants outside
1175 DATA statements and the four intrinsic functions allowed by Fortran 2003.
1176 In DATA statements, in direct assignments, where the right-hand side
1177 only contains a BOZ literal constant, and for old-style initializers of
1178 the form @code{integer i /o'0173'/}, the constant is transferred
1179 as if @code{TRANSFER} had been used; for @code{COMPLEX} numbers, only
1180 the real part is initialized unless @code{CMPLX} is used. In all other
1181 cases, the BOZ literal constant is converted to an @code{INTEGER} value with
1182 the largest decimal representation.  This value is then converted
1183 numerically to the type and kind of the variable in question.
1184 (For instance @code{real :: r = b'0000001' + 1} initializes @code{r}
1185 with @code{2.0}.) As different compilers implement the extension
1186 differently, one should be careful when doing bitwise initialization
1187 of non-integer variables.
1188
1189 Note that initializing an @code{INTEGER} variable with a statement such
1190 as @code{DATA i/Z'FFFFFFFF'/} will give an integer overflow error rather
1191 than the desired result of @math{-1} when @code{i} is a 32-bit integer
1192 on a system that supports 64-bit integers.  The @samp{-fno-range-check}
1193 option can be used as a workaround for legacy code that initializes
1194 integers in this manner.
1195
1196 @node Real array indices
1197 @subsection Real array indices
1198 @cindex array, indices of type real
1199
1200 As an extension, GNU Fortran allows the use of @code{REAL} expressions
1201 or variables as array indices.
1202
1203 @node Unary operators
1204 @subsection Unary operators
1205 @cindex operators, unary
1206
1207 As an extension, GNU Fortran allows unary plus and unary minus operators
1208 to appear as the second operand of binary arithmetic operators without
1209 the need for parenthesis.
1210
1211 @smallexample
1212        X = Y * -Z
1213 @end smallexample
1214
1215 @node Implicitly convert LOGICAL and INTEGER values
1216 @subsection Implicitly convert @code{LOGICAL} and @code{INTEGER} values
1217 @cindex conversion, to integer
1218 @cindex conversion, to logical
1219
1220 As an extension for backwards compatibility with other compilers, GNU
1221 Fortran allows the implicit conversion of @code{LOGICAL} values to
1222 @code{INTEGER} values and vice versa.  When converting from a
1223 @code{LOGICAL} to an @code{INTEGER}, @code{.FALSE.} is interpreted as
1224 zero, and @code{.TRUE.} is interpreted as one.  When converting from
1225 @code{INTEGER} to @code{LOGICAL}, the value zero is interpreted as
1226 @code{.FALSE.} and any nonzero value is interpreted as @code{.TRUE.}.
1227
1228 @smallexample
1229         LOGICAL :: l
1230         l = 1
1231 @end smallexample
1232 @smallexample
1233         INTEGER :: i
1234         i = .TRUE.
1235 @end smallexample
1236
1237 However, there is no implicit conversion of @code{INTEGER} values in
1238 @code{if}-statements, nor of @code{LOGICAL} or @code{INTEGER} values
1239 in I/O operations.
1240
1241 @node Hollerith constants support
1242 @subsection Hollerith constants support
1243 @cindex Hollerith constants
1244
1245 GNU Fortran supports Hollerith constants in assignments, function
1246 arguments, and @code{DATA} and @code{ASSIGN} statements.  A Hollerith
1247 constant is written as a string of characters preceded by an integer
1248 constant indicating the character count, and the letter @code{H} or
1249 @code{h}, and stored in bytewise fashion in a numeric (@code{INTEGER},
1250 @code{REAL}, or @code{complex}) or @code{LOGICAL} variable.  The
1251 constant will be padded or truncated to fit the size of the variable in
1252 which it is stored.
1253
1254 Examples of valid uses of Hollerith constants:
1255 @smallexample
1256       complex*16 x(2)
1257       data x /16Habcdefghijklmnop, 16Hqrstuvwxyz012345/
1258       x(1) = 16HABCDEFGHIJKLMNOP
1259       call foo (4h abc)
1260 @end smallexample
1261
1262 Invalid Hollerith constants examples:
1263 @smallexample
1264       integer*4 a
1265       a = 8H12345678 ! Valid, but the Hollerith constant will be truncated.
1266       a = 0H         ! At least one character is needed.
1267 @end smallexample
1268
1269 In general, Hollerith constants were used to provide a rudimentary
1270 facility for handling character strings in early Fortran compilers,
1271 prior to the introduction of @code{CHARACTER} variables in Fortran 77;
1272 in those cases, the standard-compliant equivalent is to convert the
1273 program to use proper character strings.  On occasion, there may be a
1274 case where the intent is specifically to initialize a numeric variable
1275 with a given byte sequence.  In these cases, the same result can be
1276 obtained by using the @code{TRANSFER} statement, as in this example.
1277 @smallexample
1278       INTEGER(KIND=4) :: a
1279       a = TRANSFER ("abcd", a)     ! equivalent to: a = 4Habcd
1280 @end smallexample
1281
1282
1283 @node Cray pointers
1284 @subsection Cray pointers
1285 @cindex pointer, Cray
1286
1287 Cray pointers are part of a non-standard extension that provides a
1288 C-like pointer in Fortran.  This is accomplished through a pair of
1289 variables: an integer "pointer" that holds a memory address, and a
1290 "pointee" that is used to dereference the pointer.
1291
1292 Pointer/pointee pairs are declared in statements of the form:
1293 @smallexample
1294         pointer ( <pointer> , <pointee> )
1295 @end smallexample
1296 or,
1297 @smallexample
1298         pointer ( <pointer1> , <pointee1> ), ( <pointer2> , <pointee2> ), ...
1299 @end smallexample
1300 The pointer is an integer that is intended to hold a memory address.
1301 The pointee may be an array or scalar.  A pointee can be an assumed
1302 size array---that is, the last dimension may be left unspecified by
1303 using a @code{*} in place of a value---but a pointee cannot be an
1304 assumed shape array.  No space is allocated for the pointee.
1305
1306 The pointee may have its type declared before or after the pointer
1307 statement, and its array specification (if any) may be declared
1308 before, during, or after the pointer statement.  The pointer may be
1309 declared as an integer prior to the pointer statement.  However, some
1310 machines have default integer sizes that are different than the size
1311 of a pointer, and so the following code is not portable:
1312 @smallexample
1313         integer ipt
1314         pointer (ipt, iarr)
1315 @end smallexample
1316 If a pointer is declared with a kind that is too small, the compiler
1317 will issue a warning; the resulting binary will probably not work
1318 correctly, because the memory addresses stored in the pointers may be
1319 truncated.  It is safer to omit the first line of the above example;
1320 if explicit declaration of ipt's type is omitted, then the compiler
1321 will ensure that ipt is an integer variable large enough to hold a
1322 pointer.
1323
1324 Pointer arithmetic is valid with Cray pointers, but it is not the same
1325 as C pointer arithmetic.  Cray pointers are just ordinary integers, so
1326 the user is responsible for determining how many bytes to add to a
1327 pointer in order to increment it.  Consider the following example:
1328 @smallexample
1329         real target(10)
1330         real pointee(10)
1331         pointer (ipt, pointee)
1332         ipt = loc (target)
1333         ipt = ipt + 1       
1334 @end smallexample
1335 The last statement does not set @code{ipt} to the address of
1336 @code{target(1)}, as it would in C pointer arithmetic.  Adding @code{1}
1337 to @code{ipt} just adds one byte to the address stored in @code{ipt}.
1338
1339 Any expression involving the pointee will be translated to use the
1340 value stored in the pointer as the base address.
1341
1342 To get the address of elements, this extension provides an intrinsic
1343 function @code{LOC()}.  The @code{LOC()} function is equivalent to the
1344 @code{&} operator in C, except the address is cast to an integer type:
1345 @smallexample
1346         real ar(10)
1347         pointer(ipt, arpte(10))
1348         real arpte
1349         ipt = loc(ar)  ! Makes arpte is an alias for ar
1350         arpte(1) = 1.0 ! Sets ar(1) to 1.0
1351 @end smallexample
1352 The pointer can also be set by a call to the @code{MALLOC} intrinsic
1353 (see @ref{MALLOC}).
1354
1355 Cray pointees often are used to alias an existing variable.  For
1356 example:
1357 @smallexample
1358         integer target(10)
1359         integer iarr(10)
1360         pointer (ipt, iarr)
1361         ipt = loc(target)
1362 @end smallexample
1363 As long as @code{ipt} remains unchanged, @code{iarr} is now an alias for
1364 @code{target}. The optimizer, however, will not detect this aliasing, so
1365 it is unsafe to use @code{iarr} and @code{target} simultaneously.  Using
1366 a pointee in any way that violates the Fortran aliasing rules or
1367 assumptions is illegal. It is the user's responsibility to avoid doing
1368 this; the compiler works under the assumption that no such aliasing
1369 occurs.
1370
1371 Cray pointers will work correctly when there is no aliasing (i.e., when
1372 they are used to access a dynamically allocated block of memory), and
1373 also in any routine where a pointee is used, but any variable with which
1374 it shares storage is not used.  Code that violates these rules may not
1375 run as the user intends.  This is not a bug in the optimizer; any code
1376 that violates the aliasing rules is illegal.  (Note that this is not
1377 unique to GNU Fortran; any Fortran compiler that supports Cray pointers
1378 will ``incorrectly'' optimize code with illegal aliasing.)
1379
1380 There are a number of restrictions on the attributes that can be applied
1381 to Cray pointers and pointees.  Pointees may not have the
1382 @code{ALLOCATABLE}, @code{INTENT}, @code{OPTIONAL}, @code{DUMMY},
1383 @code{TARGET}, @code{INTRINSIC}, or @code{POINTER} attributes. Pointers
1384 may not have the @code{DIMENSION}, @code{POINTER}, @code{TARGET},
1385 @code{ALLOCATABLE}, @code{EXTERNAL}, or @code{INTRINSIC} attributes.
1386 Pointees may not occur in more than one pointer statement.  A pointee
1387 cannot be a pointer.  Pointees cannot occur in equivalence, common, or
1388 data statements.
1389
1390 A Cray pointer may also point to a function or a subroutine.  For
1391 example, the following excerpt is valid:
1392 @smallexample
1393   implicit none
1394   external sub
1395   pointer (subptr,subpte)
1396   external subpte
1397   subptr = loc(sub)
1398   call subpte()
1399   [...]
1400   subroutine sub
1401   [...]
1402   end subroutine sub
1403 @end smallexample
1404
1405 A pointer may be modified during the course of a program, and this
1406 will change the location to which the pointee refers.  However, when
1407 pointees are passed as arguments, they are treated as ordinary
1408 variables in the invoked function.  Subsequent changes to the pointer
1409 will not change the base address of the array that was passed.
1410
1411 @node CONVERT specifier
1412 @subsection @code{CONVERT} specifier
1413 @cindex @code{CONVERT} specifier
1414
1415 GNU Fortran allows the conversion of unformatted data between little-
1416 and big-endian representation to facilitate moving of data
1417 between different systems.  The conversion can be indicated with
1418 the @code{CONVERT} specifier on the @code{OPEN} statement.
1419 @xref{GFORTRAN_CONVERT_UNIT}, for an alternative way of specifying
1420 the data format via an environment variable.
1421
1422 Valid values for @code{CONVERT} are:
1423 @itemize @w{}
1424 @item @code{CONVERT='NATIVE'} Use the native format.  This is the default.
1425 @item @code{CONVERT='SWAP'} Swap between little- and big-endian.
1426 @item @code{CONVERT='LITTLE_ENDIAN'} Use the little-endian representation
1427 for unformatted files.
1428 @item @code{CONVERT='BIG_ENDIAN'} Use the big-endian representation for
1429 unformatted files.
1430 @end itemize
1431
1432 Using the option could look like this:
1433 @smallexample
1434   open(file='big.dat',form='unformatted',access='sequential', &
1435        convert='big_endian')
1436 @end smallexample
1437
1438 The value of the conversion can be queried by using
1439 @code{INQUIRE(CONVERT=ch)}.  The values returned are
1440 @code{'BIG_ENDIAN'} and @code{'LITTLE_ENDIAN'}.
1441
1442 @code{CONVERT} works between big- and little-endian for
1443 @code{INTEGER} values of all supported kinds and for @code{REAL}
1444 on IEEE systems of kinds 4 and 8.  Conversion between different
1445 ``extended double'' types on different architectures such as
1446 m68k and x86_64, which GNU Fortran
1447 supports as @code{REAL(KIND=10)} and @code{REAL(KIND=16)}, will
1448 probably not work.
1449
1450 @emph{Note that the values specified via the GFORTRAN_CONVERT_UNIT
1451 environment variable will override the CONVERT specifier in the
1452 open statement}.  This is to give control over data formats to
1453 users who do not have the source code of their program available.
1454
1455 Using anything but the native representation for unformatted data
1456 carries a significant speed overhead.  If speed in this area matters
1457 to you, it is best if you use this only for data that needs to be
1458 portable.
1459
1460 @node OpenMP
1461 @subsection OpenMP
1462 @cindex OpenMP
1463
1464 OpenMP (Open Multi-Processing) is an application programming
1465 interface (API) that supports multi-platform shared memory 
1466 multiprocessing programming in C/C++ and Fortran on many 
1467 architectures, including Unix and Microsoft Windows platforms.
1468 It consists of a set of compiler directives, library routines,
1469 and environment variables that influence run-time behavior.
1470
1471 GNU Fortran strives to be compatible to the 
1472 @uref{http://www.openmp.org/drupal/mp-documents/spec25.pdf,
1473 OpenMP Application Program Interface v2.5}.
1474
1475 To enable the processing of the OpenMP directive @code{!$omp} in
1476 free-form source code; the @code{c$omp}, @code{*$omp} and @code{!$omp}
1477 directives in fixed form; the @code{!$} conditional compilation sentinels
1478 in free form; and the @code{c$}, @code{*$} and @code{!$} sentinels
1479 in fixed form, @command{gfortran} needs to be invoked with the
1480 @option{-fopenmp}. This also arranges for automatic linking of the
1481 GNU OpenMP runtime library @ref{Top,,libgomp,libgomp,GNU OpenMP
1482 runtime library}.
1483
1484 The OpenMP Fortran runtime library routines are provided both in a
1485 form of a Fortran 90 module named @code{omp_lib} and in a form of
1486 a Fortran @code{include} file named @file{omp_lib.h}.
1487
1488 An example of a parallelized loop taken from Appendix A.1 of
1489 the OpenMP Application Program Interface v2.5:
1490 @smallexample
1491 SUBROUTINE A1(N, A, B)
1492   INTEGER I, N
1493   REAL B(N), A(N)
1494 !$OMP PARALLEL DO !I is private by default
1495   DO I=2,N
1496     B(I) = (A(I) + A(I-1)) / 2.0
1497   ENDDO
1498 !$OMP END PARALLEL DO
1499 END SUBROUTINE A1
1500 @end smallexample
1501
1502 Please note:
1503 @itemize
1504 @item
1505 @option{-fopenmp} implies @option{-frecursive}, i.e., all local arrays
1506 will be allocated on the stack. When porting existing code to OpenMP,
1507 this may lead to surprising results, especially to segmentation faults
1508 if the stacksize is limited.
1509
1510 @item
1511 On glibc-based systems, OpenMP enabled applications can not be statically
1512 linked due to limitations of the underlying pthreads-implementation. It
1513 might be possible to get a working solution if 
1514 @command{-Wl,--whole-archive -lpthread -Wl,--no-whole-archive} is added
1515 to the command line. However, this is not supported by @command{gcc} and
1516 thus not recommended.
1517 @end itemize
1518
1519 @node Argument list functions
1520 @subsection Argument list functions @code{%VAL}, @code{%REF} and @code{%LOC}
1521 @cindex argument list functions
1522 @cindex @code{%VAL}
1523 @cindex @code{%REF}
1524 @cindex @code{%LOC}
1525
1526 GNU Fortran supports argument list functions @code{%VAL}, @code{%REF} 
1527 and @code{%LOC} statements, for backward compatibility with g77. 
1528 It is recommended that these should be used only for code that is 
1529 accessing facilities outside of GNU Fortran, such as operating system 
1530 or windowing facilities. It is best to constrain such uses to isolated 
1531 portions of a program--portions that deal specifically and exclusively 
1532 with low-level, system-dependent facilities. Such portions might well 
1533 provide a portable interface for use by the program as a whole, but are 
1534 themselves not portable, and should be thoroughly tested each time they 
1535 are rebuilt using a new compiler or version of a compiler.
1536
1537 @code{%VAL} passes a scalar argument by value, @code{%REF} passes it by 
1538 reference and @code{%LOC} passes its memory location.  Since gfortran 
1539 already passes scalar arguments by reference, @code{%REF} is in effect 
1540 a do-nothing.  @code{%LOC} has the same effect as a fortran pointer.
1541
1542 An example of passing an argument by value to a C subroutine foo.:
1543 @smallexample
1544 C
1545 C prototype      void foo_ (float x);
1546 C
1547       external foo
1548       real*4 x
1549       x = 3.14159
1550       call foo (%VAL (x))
1551       end
1552 @end smallexample
1553
1554 For details refer to the g77 manual
1555 @uref{http://gcc.gnu.org/onlinedocs/gcc-3.4.6/g77/index.html#Top}.
1556
1557 Also, the gfortran testsuite c_by_val.f and its partner c_by_val.c are
1558 worth a look.
1559
1560
1561
1562 @node Extensions not implemented in GNU Fortran
1563 @section Extensions not implemented in GNU Fortran
1564 @cindex extensions, not implemented
1565
1566 The long history of the Fortran language, its wide use and broad
1567 userbase, the large number of different compiler vendors and the lack of
1568 some features crucial to users in the first standards have lead to the
1569 existence of a number of important extensions to the language.  While
1570 some of the most useful or popular extensions are supported by the GNU
1571 Fortran compiler, not all existing extensions are supported.  This section
1572 aims at listing these extensions and offering advice on how best make
1573 code that uses them running with the GNU Fortran compiler.
1574
1575 @c More can be found here:
1576 @c   -- http://gcc.gnu.org/onlinedocs/gcc-3.4.6/g77/Missing-Features.html
1577 @c   -- the list of fortran and libgfortran bugs closed as WONTFIX:
1578 @c      http://tinyurl.com/2u4h5y
1579
1580 @menu
1581 * STRUCTURE and RECORD::
1582 @c * UNION and MAP::
1583 * ENCODE and DECODE statements::
1584 @c * Expressions in FORMAT statements::
1585 @c * Q edit descriptor::
1586 @c * AUTOMATIC statement::
1587 @c * TYPE and ACCEPT I/O Statements::
1588 @c * .XOR. operator::
1589 @c * CARRIAGECONTROL, DEFAULTFILE, DISPOSE and RECORDTYPE I/O specifiers::
1590 @c * Omitted arguments in procedure call:
1591 @end menu
1592
1593
1594 @node STRUCTURE and RECORD
1595 @subsection @code{STRUCTURE} and @code{RECORD}
1596 @cindex @code{STRUCTURE}
1597 @cindex @code{RECORD}
1598
1599 Structures are user-defined aggregate data types; this functionality was
1600 standardized in Fortran 90 with an different syntax, under the name of
1601 ``derived types''. Here is an example of code using the non portable
1602 structure syntax:
1603
1604 @example
1605 ! Declaring a structure named ``item'' and containing three fields:
1606 ! an integer ID, an description string and a floating-point price.
1607 STRUCTURE /item/
1608   INTEGER id
1609   CHARACTER(LEN=200) description
1610   REAL price
1611 END STRUCTURE
1612
1613 ! Define two variables, an single record of type ``item''
1614 ! named ``pear'', and an array of items named ``store_catalog''
1615 RECORD /item/ pear, store_catalog(100)
1616
1617 ! We can directly access the fields of both variables
1618 pear.id = 92316
1619 pear.description = "juicy D'Anjou pear"
1620 pear.price = 0.15
1621 store_catalog(7).id = 7831
1622 store_catalog(7).description = "milk bottle"
1623 store_catalog(7).price = 1.2
1624
1625 ! We can also manipulate the whole structure
1626 store_catalog(12) = pear
1627 print *, store_catalog(12)
1628 @end example
1629
1630 @noindent
1631 This code can easily be rewritten in the Fortran 90 syntax as following:
1632
1633 @example
1634 ! ``STRUCTURE /name/ ... END STRUCTURE'' becomes
1635 ! ``TYPE name ... END TYPE''
1636 TYPE item
1637   INTEGER id
1638   CHARACTER(LEN=200) description
1639   REAL price
1640 END TYPE
1641
1642 ! ``RECORD /name/ variable'' becomes ``TYPE(name) variable''
1643 TYPE(item) pear, store_catalog(100)
1644
1645 ! Instead of using a dot (.) to access fields of a record, the
1646 ! standard syntax uses a percent sign (%)
1647 pear%id = 92316
1648 pear%description = "juicy D'Anjou pear"
1649 pear%price = 0.15
1650 store_catalog(7)%id = 7831
1651 store_catalog(7)%description = "milk bottle"
1652 store_catalog(7)%price = 1.2
1653
1654 ! Assignments of a whole variable don't change
1655 store_catalog(12) = pear
1656 print *, store_catalog(12)
1657 @end example
1658
1659
1660 @c @node UNION and MAP
1661 @c @subsection @code{UNION} and @code{MAP}
1662 @c @cindex @code{UNION}
1663 @c @cindex @code{MAP}
1664 @c
1665 @c For help writing this one, see
1666 @c http://www.eng.umd.edu/~nsw/ench250/fortran1.htm#UNION and
1667 @c http://www.tacc.utexas.edu/services/userguides/pgi/pgiws_ug/pgi32u06.htm
1668
1669
1670 @node ENCODE and DECODE statements
1671 @subsection @code{ENCODE} and @code{DECODE} statements
1672 @cindex @code{ENCODE}
1673 @cindex @code{DECODE}
1674
1675 GNU Fortran doesn't support the @code{ENCODE} and @code{DECODE}
1676 statements.  These statements are best replaced by @code{READ} and
1677 @code{WRITE} statements involving internal files (@code{CHARACTER}
1678 variables and arrays), which have been part of the Fortran standard since
1679 Fortran 77. For example, replace a code fragment like
1680
1681 @smallexample
1682       INTEGER*1 LINE(80)
1683       REAL A, B, C
1684 c     ... Code that sets LINE
1685       DECODE (80, 9000, LINE) A, B, C
1686  9000 FORMAT (1X, 3(F10.5))
1687 @end smallexample
1688
1689 @noindent
1690 with the following:
1691
1692 @smallexample
1693       CHARACTER(LEN=80) LINE
1694       REAL A, B, C
1695 c     ... Code that sets LINE
1696       READ (UNIT=LINE, FMT=9000) A, B, C
1697  9000 FORMAT (1X, 3(F10.5))
1698 @end smallexample
1699
1700 Similarly, replace a code fragment like
1701
1702 @smallexample
1703       INTEGER*1 LINE(80)
1704       REAL A, B, C
1705 c     ... Code that sets A, B and C
1706       ENCODE (80, 9000, LINE) A, B, C
1707  9000 FORMAT (1X, 'OUTPUT IS ', 3(F10.5))
1708 @end smallexample
1709
1710 @noindent
1711 with the following:
1712
1713 @smallexample
1714       INTEGER*1 LINE(80)
1715       REAL A, B, C
1716 c     ... Code that sets A, B and C
1717       WRITE (UNIT=LINE, FMT=9000) A, B, C
1718  9000 FORMAT (1X, 'OUTPUT IS ', 3(F10.5))
1719 @end smallexample
1720
1721
1722 @c ---------------------------------------------------------------------
1723 @c Intrinsic Procedures
1724 @c ---------------------------------------------------------------------
1725
1726 @include intrinsic.texi
1727
1728
1729 @tex
1730 \blankpart
1731 @end tex
1732
1733 @c ---------------------------------------------------------------------
1734 @c Contributing
1735 @c ---------------------------------------------------------------------
1736
1737 @node Contributing
1738 @unnumbered Contributing
1739 @cindex Contributing
1740
1741 Free software is only possible if people contribute to efforts
1742 to create it.
1743 We're always in need of more people helping out with ideas
1744 and comments, writing documentation and contributing code.
1745
1746 If you want to contribute to GNU Fortran,
1747 have a look at the long lists of projects you can take on.
1748 Some of these projects are small,
1749 some of them are large;
1750 some are completely orthogonal to the rest of what is
1751 happening on GNU Fortran,
1752 but others are ``mainstream'' projects in need of enthusiastic hackers.
1753 All of these projects are important!
1754 We'll eventually get around to the things here,
1755 but they are also things doable by someone who is willing and able.
1756
1757 @menu
1758 * Contributors::
1759 * Projects::
1760 * Proposed Extensions::
1761 @end menu
1762
1763
1764 @node Contributors
1765 @section Contributors to GNU Fortran
1766 @cindex Contributors
1767 @cindex Credits
1768 @cindex Authors
1769
1770 Most of the parser was hand-crafted by @emph{Andy Vaught}, who is
1771 also the initiator of the whole project.  Thanks Andy!
1772 Most of the interface with GCC was written by @emph{Paul Brook}.
1773
1774 The following individuals have contributed code and/or
1775 ideas and significant help to the GNU Fortran project
1776 (in alphabetical order):
1777
1778 @itemize @minus
1779 @item Janne Blomqvist
1780 @item Steven Bosscher
1781 @item Paul Brook
1782 @item Tobias Burnus
1783 @item Fran@,{c}ois-Xavier Coudert
1784 @item Bud Davis
1785 @item Jerry DeLisle
1786 @item Erik Edelmann
1787 @item Bernhard Fischer
1788 @item Daniel Franke
1789 @item Richard Guenther
1790 @item Richard Henderson
1791 @item Katherine Holcomb
1792 @item Jakub Jelinek
1793 @item Niels Kristian Bech Jensen
1794 @item Steven Johnson
1795 @item Steven G. Kargl
1796 @item Thomas Koenig
1797 @item Asher Langton
1798 @item H. J. Lu
1799 @item Toon Moene
1800 @item Brooks Moses
1801 @item Andrew Pinski
1802 @item Tim Prince
1803 @item Christopher D. Rickett
1804 @item Richard Sandiford
1805 @item Tobias Schl@"uter
1806 @item Roger Sayle
1807 @item Paul Thomas
1808 @item Andy Vaught
1809 @item Feng Wang
1810 @item Janus Weil
1811 @end itemize
1812
1813 The following people have contributed bug reports,
1814 smaller or larger patches,
1815 and much needed feedback and encouragement for the
1816 GNU Fortran project: 
1817
1818 @itemize @minus
1819 @item Bill Clodius
1820 @item Dominique d'Humi@`eres
1821 @item Kate Hedstrom
1822 @item Erik Schnetter
1823 @end itemize
1824
1825 Many other individuals have helped debug,
1826 test and improve the GNU Fortran compiler over the past few years,
1827 and we welcome you to do the same!
1828 If you already have done so,
1829 and you would like to see your name listed in the
1830 list above, please contact us.
1831
1832
1833 @node Projects
1834 @section Projects
1835
1836 @table @emph
1837
1838 @item Help build the test suite
1839 Solicit more code for donation to the test suite: the more extensive the
1840 testsuite, the smaller the risk of breaking things in the future! We can
1841 keep code private on request.
1842
1843 @item Bug hunting/squishing
1844 Find bugs and write more test cases! Test cases are especially very
1845 welcome, because it allows us to concentrate on fixing bugs instead of
1846 isolating them. Going through the bugzilla database at
1847 @url{http://gcc.gnu.org/bugzilla/} to reduce testcases posted there and
1848 add more information (for example, for which version does the testcase
1849 work, for which versions does it fail?) is also very helpful.
1850
1851 @end table
1852
1853
1854 @node Proposed Extensions
1855 @section Proposed Extensions
1856
1857 Here's a list of proposed extensions for the GNU Fortran compiler, in no particular
1858 order.  Most of these are necessary to be fully compatible with
1859 existing Fortran compilers, but they are not part of the official
1860 J3 Fortran 95 standard.
1861
1862 @subsection Compiler extensions: 
1863 @itemize @bullet
1864 @item
1865 User-specified alignment rules for structures.
1866
1867 @item
1868 Flag to generate @code{Makefile} info.
1869
1870 @item
1871 Automatically extend single precision constants to double.
1872
1873 @item
1874 Compile code that conserves memory by dynamically allocating common and
1875 module storage either on stack or heap.
1876
1877 @item
1878 Compile flag to generate code for array conformance checking (suggest -CC).
1879
1880 @item
1881 User control of symbol names (underscores, etc).
1882
1883 @item
1884 Compile setting for maximum size of stack frame size before spilling
1885 parts to static or heap.
1886
1887 @item
1888 Flag to force local variables into static space.
1889
1890 @item
1891 Flag to force local variables onto stack.
1892 @end itemize
1893
1894
1895 @subsection Environment Options
1896 @itemize @bullet
1897 @item
1898 Pluggable library modules for random numbers, linear algebra.
1899 LA should use BLAS calling conventions.
1900
1901 @item
1902 Environment variables controlling actions on arithmetic exceptions like
1903 overflow, underflow, precision loss---Generate NaN, abort, default.
1904 action.
1905
1906 @item
1907 Set precision for fp units that support it (i387).
1908
1909 @item
1910 Variable for setting fp rounding mode.
1911
1912 @item
1913 Variable to fill uninitialized variables with a user-defined bit
1914 pattern.
1915
1916 @item
1917 Environment variable controlling filename that is opened for that unit
1918 number.
1919
1920 @item
1921 Environment variable to clear/trash memory being freed.
1922
1923 @item
1924 Environment variable to control tracing of allocations and frees.
1925
1926 @item
1927 Environment variable to display allocated memory at normal program end.
1928
1929 @item
1930 Environment variable for filename for * IO-unit.
1931
1932 @item
1933 Environment variable for temporary file directory.
1934
1935 @item
1936 Environment variable forcing standard output to be line buffered (unix).
1937
1938 @end itemize
1939
1940
1941 @c ---------------------------------------------------------------------
1942 @c GNU General Public License
1943 @c ---------------------------------------------------------------------
1944
1945 @include gpl_v3.texi
1946
1947
1948
1949 @c ---------------------------------------------------------------------
1950 @c GNU Free Documentation License
1951 @c ---------------------------------------------------------------------
1952
1953 @include fdl.texi
1954
1955
1956
1957 @c ---------------------------------------------------------------------
1958 @c Funding Free Software
1959 @c ---------------------------------------------------------------------
1960
1961 @include funding.texi
1962
1963 @c ---------------------------------------------------------------------
1964 @c Indices
1965 @c ---------------------------------------------------------------------
1966
1967 @node Option Index
1968 @unnumbered Option Index
1969 @command{gfortran}'s command line options are indexed here without any
1970 initial @samp{-} or @samp{--}. Where an option has both positive and
1971 negative forms (such as -foption and -fno-option), relevant entries in
1972 the manual are indexed under the most appropriate form; it may sometimes
1973 be useful to look up both forms.
1974 @printindex op
1975
1976 @node Keyword Index
1977 @unnumbered Keyword Index
1978 @printindex cp
1979
1980 @bye