OSDN Git Service

2009-11-19 Tobias Burnus <burnus@net-b.de>
[pf3gnuchains/gcc-fork.git] / gcc / fortran / gfortran.texi
index 84795fb..1430c8a 100644 (file)
@@ -1,7 +1,7 @@
 \input texinfo  @c -*-texinfo-*-
 @c %**start of header
 @setfilename gfortran.info
-@set copyrights-gfortran 1999-2007
+@set copyrights-gfortran 1999-2008
 
 @include gcc-common.texi
 
 Copyright @copyright{} @value{copyrights-gfortran} Free Software Foundation, Inc.
 
 Permission is granted to copy, distribute and/or modify this document
-under the terms of the GNU Free Documentation License, Version 1.1 or
+under the terms of the GNU Free Documentation License, Version 1.2 or
 any later version published by the Free Software Foundation; with the
-Invariant Sections being ``GNU General Public License'' and ``Funding
-Free Software'', the Front-Cover
-texts being (a) (see below), and with the Back-Cover Texts being (b)
+Invariant Sections being ``Funding Free Software'', the Front-Cover
+Texts being (a) (see below), and with the Back-Cover Texts being (b)
 (see below).  A copy of the license is included in the section entitled
 ``GNU Free Documentation License''.
 
@@ -181,7 +180,9 @@ Part I: Invoking GNU Fortran
 * Runtime::              Influencing runtime behavior with environment variables.
 
 Part II: Language Reference
-* Fortran 2003 status::  Fortran 2003 features supported by GNU Fortran.
+* Fortran 2003 and 2008 status::  Fortran 2003 and 2008 features supported by GNU Fortran.
+* Compiler Characteristics::      KIND type parameters supported.
+* Mixed-Language Programming::    Interoperability with C
 * Extensions::           Language extensions implemented by GNU Fortran.
 * Intrinsic Procedures:: Intrinsic procedures supported by GNU Fortran.
 * Intrinsic Modules::    Intrinsic modules supported by GNU Fortran.
@@ -190,7 +191,7 @@ Part II: Language Reference
 * Copying::              GNU General Public License says
                          how you can copy and share GNU Fortran.
 * GNU Free Documentation License::
-                        How you can copy and share this manual.
+                         How you can copy and share this manual.
 * Funding::              How to help assure continued work for free software.
 * Option Index::         Index of command line options
 * Keyword Index::        Index of concepts
@@ -229,7 +230,7 @@ or alternative to, the unix @command{f95} command;
 * Preprocessing and conditional compilation:: The Fortran preprocessor
 * GNU Fortran and G77::  Why we chose to start from scratch.
 * Project Status::       Status of GNU Fortran, roadmap, proposed extensions.
-* Standards::           Standards supported by GNU Fortran.
+* Standards::            Standards supported by GNU Fortran.
 @end menu
 
 
@@ -240,18 +241,16 @@ or alternative to, the unix @command{f95} command;
 @node About GNU Fortran
 @section About GNU Fortran
 
-The GNU Fortran compiler is still in an early state of development.
-It can generate code for most constructs and expressions,
-but much work remains to be done.
-
-When the GNU Fortran compiler is finished,
-it will do everything you expect from any decent compiler: 
+The GNU Fortran compiler supports the Fortran 77, 90 and 95 standards
+completely, parts of the Fortran 2003 and Fortran 2008 standards, and
+several vendor extensions. The development goal is to provide the
+following features:
 
 @itemize @bullet
 @item
 Read a user's program,
 stored in a file and containing instructions written
-in Fortran 77, Fortran 90, Fortran 95 or Fortran 2003.
+in Fortran 77, Fortran 90, Fortran 95, Fortran 2003 or Fortran 2008.
 This file contains @dfn{source code}.
 
 @item
@@ -264,14 +263,13 @@ code designed to be efficiently translated and processed
 by a machine such as your computer.
 Humans usually aren't as good writing machine code
 as they are at writing Fortran (or C++, Ada, or Java),
-because is easy to make tiny mistakes writing machine code.
+because it is easy to make tiny mistakes writing machine code.
 
 @item
 Provide the user with information about the reasons why
 the compiler is unable to create a binary from the source code.
 Usually this will be the case if the source code is flawed.
-When writing Fortran, it is easy to make big mistakes.
-The Fortran 90 requires that the compiler can point out
+The Fortran 90 standard requires that the compiler can point out
 mistakes to the user.
 An incorrect usage of the language causes an @dfn{error message}.
 
@@ -369,17 +367,19 @@ Fortran) for each file in the source code, and then calls the assembler
 and linker as appropriate to produce the compiled output. In a copy of
 GCC which has been compiled with Fortran language support enabled,
 @command{gcc} will recognize files with @file{.f}, @file{.for}, @file{.ftn},
-@file{.f90}, @file{.f95}, and @file{.f03} extensions as Fortran source code,
-and compile it accordingly. A @command{gfortran} driver program is also
-provided, which is identical to @command{gcc} except that it automatically
-links the Fortran runtime libraries into the compiled program.
+@file{.f90}, @file{.f95}, @file{.f03} and @file{.f08} extensions as
+Fortran source code, and compile it accordingly. A @command{gfortran}
+driver program is also provided, which is identical to @command{gcc}
+except that it automatically links the Fortran runtime libraries into the
+compiled program.
 
 Source files with @file{.f}, @file{.for}, @file{.fpp}, @file{.ftn}, @file{.F},
 @file{.FOR}, @file{.FPP}, and @file{.FTN} extensions are treated as fixed form.
-Source files with @file{.f90}, @file{.f95}, @file{.f03}, @file{.F90}, 
-@file{.F95}, and @file{.F03} extensions are treated as free form.  The
-capitalized versions of either form are run through preprocessing. Source files
-with the lower case @file{.fpp} extension are also run through preprocessing.
+Source files with @file{.f90}, @file{.f95}, @file{.f03}, @file{.f08},
+@file{.F90}, @file{.F95}, @file{.F03} and @file{.F08} extensions are
+treated as free form.  The capitalized versions of either form are run
+through preprocessing. Source files with the lower case @file{.fpp}
+extension are also run through preprocessing.
 
 This manual specifically documents the Fortran front end, which handles
 the programming language's syntax and semantics.  The aspects of GCC
@@ -400,19 +400,24 @@ Fortran compiler.
 @cindex FPP
 @cindex Conditional compilation
 @cindex Preprocessing
+@cindex preprocessor, include file handling
 
 Many Fortran compilers including GNU Fortran allow passing the source code
 through a C preprocessor (CPP; sometimes also called the Fortran preprocessor,
 FPP) to allow for conditional compilation. In the case of GNU Fortran,
 this is the GNU C Preprocessor in the traditional mode. On systems with
 case-preserving file names, the preprocessor is automatically invoked if the
-file extension is @code{.F}, @code{.FOR}, @code{.FTN}, @code{.F90},
-@code{.F95} or @code{.F03}; otherwise use for fixed-format code the option
-@code{-x f77-cpp-input} and for free-format code @code{-x f95-cpp-input}.
-Invocation of the preprocessor can be suppressed using @code{-x f77} or
-@code{-x f95}.
+filename extension is @code{.F}, @code{.FOR}, @code{.FTN}, @code{.fpp},
+@code{.FPP}, @code{.F90}, @code{.F95}, @code{.F03} or @code{.F08}. To manually
+invoke the preprocessor on any file, use @option{-cpp}, to disable
+preprocessing on files where the preprocessor is run automatically, use
+@option{-nocpp}.
+
+If a preprocessed file includes another file with the Fortran @code{INCLUDE}
+statement, the included file is not preprocessed. To preprocess included
+files, use the equivalent preprocessor statement @code{#include}.
 
-If the GNU Fortran invoked the preprocessor, @code{__GFORTRAN__}
+If GNU Fortran invokes the preprocessor, @code{__GFORTRAN__}
 is defined and @code{__GNUC__}, @code{__GNUC_MINOR__} and
 @code{__GNUC_PATCHLEVEL__} can be used to determine the version of the
 compiler. See @ref{Top,,Overview,cpp,The C Preprocessor} for details.
@@ -468,10 +473,10 @@ The GNU Fortran compiler is able to compile nearly all
 standard-compliant Fortran 95, Fortran 90, and Fortran 77 programs,
 including a number of standard and non-standard extensions, and can be
 used on real-world programs.  In particular, the supported extensions
-include OpenMP, Cray-style pointers, and several Fortran 2003 features
-such as enumeration, stream I/O, and some of the enhancements to
-allocatable array support from TR 15581.  However, it is still under
-development and has a few remaining rough edges.
+include OpenMP, Cray-style pointers, and several Fortran 2003 and Fortran
+2008 features such as enumeration, stream I/O, and some of the
+enhancements to allocatable array support from TR 15581.  However, it is
+still under development and has a few remaining rough edges.
 
 At present, the GNU Fortran compiler passes the
 @uref{http://www.fortran-2000.com/ArnaudRecipes/fcvs21_f95.html, 
@@ -498,7 +503,7 @@ The primary work remaining to be done on GNU Fortran falls into three
 categories: bug fixing (primarily regarding the treatment of invalid code
 and providing useful error messages), improving the compiler optimizations
 and the performance of compiled code, and extending the compiler to support
-future standards---in particular, Fortran 2003.
+future standards---in particular, Fortran 2003 and Fortran 2008.
 
 
 @c ---------------------------------------------------------------------
@@ -509,6 +514,10 @@ future standards---in particular, Fortran 2003.
 @section Standards
 @cindex Standards
 
+@menu
+* Varying Length Character Strings::
+@end menu
+
 The GNU Fortran compiler implements
 ISO/IEC 1539:1997 (Fortran 95).  As such, it can also compile essentially all
 standard-compliant Fortran 90 and Fortran 77 programs.   It also supports
@@ -516,9 +525,35 @@ the ISO/IEC TR-15581 enhancements to allocatable arrays, and
 the @uref{http://www.openmp.org/drupal/mp-documents/spec25.pdf,
 OpenMP Application Program Interface v2.5} specification.
 
-In the future, the GNU Fortran compiler may also support other standard 
-variants of and extensions to the Fortran language.  These include
-ISO/IEC 1539-1:2004 (Fortran 2003).
+In the future, the GNU Fortran compiler will also support ISO/IEC
+1539-1:2004 (Fortran 2003) and future Fortran standards. Partial support
+of that standard is already provided; the current status of Fortran 2003
+support is reported in the @ref{Fortran 2003 status} section of the
+documentation.
+
+The next version of the Fortran standard (Fortran 2008) is currently
+being developed and the GNU Fortran compiler supports some of its new
+features. This support is based on the latest draft of the standard
+(available from @url{http://www.nag.co.uk/sc22wg5/}) and no guarantee of
+future compatibility is made, as the final standard might differ from the
+draft. For more information, see the @ref{Fortran 2008 status} section.
+
+Additionally, the GNU Fortran compilers supports the OpenMP specification
+(version 3.0, @url{http://openmp.org/wp/openmp-specifications/}).
+
+@node Varying Length Character Strings
+@subsection Varying Length Character Strings
+@cindex Varying length character strings
+@cindex Varying length strings
+@cindex strings, varying length
+
+The Fortran 95 standard specifies in Part 2 (ISO/IEC 1539-2:2000)
+varying length character strings. While GNU Fortran currently does not
+support such strings directly, there exist two Fortran implementations
+for them, which work with GNU Fortran. They can be found at
+@uref{http://www.fortran.com/@/iso_varying_string.f95} and at
+@uref{ftp://ftp.nag.co.uk/@/sc22wg5/@/ISO_VARYING_STRING/}.
+
 
 
 @c =====================================================================
@@ -613,11 +648,10 @@ the first letter is @samp{n}, @samp{N} or @samp{0}, I/O is buffered.
 This is the default.
 
 @node GFORTRAN_UNBUFFERED_PRECONNECTED
-@section @env{GFORTRAN_UNBUFFERED_PRECONNECTED}---Don't buffer I/O on
-preconnected units
+@section @env{GFORTRAN_UNBUFFERED_PRECONNECTED}---Don't buffer I/O on preconnected units
 
 The environment variable named @env{GFORTRAN_UNBUFFERED_PRECONNECTED} controls
-whether I/O on a preconnected unit (i.e STDOUT or STDERR) is unbuffered.  If 
+whether I/O on a preconnected unit (i.e.@: STDOUT or STDERR) is unbuffered.  If 
 the first letter is @samp{y}, @samp{Y} or @samp{1}, I/O is unbuffered. This
 will slow down small sequential reads and writes.  If the first letter
 is @samp{n}, @samp{N} or @samp{0}, I/O is buffered.  This is the default.
@@ -683,7 +717,7 @@ the modes are the same as for the @code{CONVERT} specifier:
 @item @code{NATIVE} Use the native format.  This is the default.
 @item @code{SWAP} Swap between little- and big-endian.
 @item @code{LITTLE_ENDIAN} Use the little-endian format
-        for unformatted files.
+for unformatted files.
 @item @code{BIG_ENDIAN} Use the big-endian format for unformatted files.
 @end itemize
 A missing mode for an exception is taken to mean @code{BIG_ENDIAN}.
@@ -759,15 +793,23 @@ was used.
 @end tex
 
 @c ---------------------------------------------------------------------
-@c Fortran 2003 Status
+@c Fortran 2003 and 2008 Status
 @c ---------------------------------------------------------------------
 
+@node Fortran 2003 and 2008 status
+@chapter Fortran 2003 and 2008 Status
+
+@menu
+* Fortran 2003 status::
+* Fortran 2008 status::
+@end menu
+
 @node Fortran 2003 status
-@chapter Fortran 2003 Status
+@section Fortran 2003 status
 
-Although GNU Fortran focuses on implementing the Fortran 95
-standard for the time being, a few Fortran 2003 features are currently
-available.
+GNU Fortran supports several Fortran 2003 features; an incomplete
+list can be found below.  See also the
+@uref{http://gcc.gnu.org/wiki/Fortran2003, wiki page} about Fortran 2003.
 
 @itemize
 @item 
@@ -779,7 +821,8 @@ Intrinsics @code{command_argument_count}, @code{get_command},
 @cindex array, constructors
 @cindex @code{[...]}
 Array constructors using square brackets. That is, @code{[...]} rather
-than @code{(/.../)}.
+than @code{(/.../)}.  Type-specification for array constructors like
+@code{(/ some-type :: ... /)}.
 
 @item
 @cindex @code{FLUSH} statement
@@ -817,6 +860,14 @@ TR 15581:
 @end itemize
 
 @item
+@cindex @code{ALLOCATE}
+The @code{ERRMSG=} tag is now supported in @code{ALLOCATE} and
+@code{DEALLOCATE} statements.  The @code{SOURCE=} tag is supported
+in an @code{ALLOCATE} statement.  An @emph{intrinsic-type-spec}
+can be used as the @emph{type-spec} in an @code{ALLOCATE} statement;
+while the use of a @emph{derived-type-name} is currently unsupported.
+
+@item
 @cindex @code{STREAM} I/O
 @cindex @code{ACCESS='STREAM'} I/O
 The @code{OPEN} statement supports the @code{ACCESS='STREAM'} specifier,
@@ -863,11 +914,105 @@ Renaming of operators in the @code{USE} statement.
 Interoperability with C (ISO C Bindings)
 
 @item
-BOZ as argument of INT, REAL, DBLE and CMPLX.
+BOZ as argument of @code{INT}, @code{REAL}, @code{DBLE} and @code{CMPLX}.
+
+@item
+@cindex type-bound procedure
+@cindex type-bound operator
+Type-bound procedures with @code{PROCEDURE} or @code{GENERIC}, and operators
+bound to a derived-type.
+
+@item
+@cindex @code{EXTENDS}
+@cindex derived-type extension
+Extension of derived-types (the @code{EXTENDS(...)} syntax).
+
+@item
+@cindex @code{ABSTRACT} type
+@cindex @code{DEFERRED} procedure binding
+@code{ABSTRACT} derived-types and declaring procedure bindings @code{DEFERRED}.
 
 @end itemize
 
 
+@node Fortran 2008 status
+@section Fortran 2008 status
+
+The next version of the Fortran standard after Fortran 2003 is currently
+being worked on by the Working Group 5 of Sub-Committee 22 of the Joint
+Technical Committee 1 of the International Organization for
+Standardization (ISO) and the International Electrotechnical Commission
+(IEC). This group is known as @uref{http://www.nag.co.uk/sc22wg5/, WG5}.
+The next revision of the Fortran standard is informally referred to as
+Fortran 2008, reflecting its planned release year. The GNU Fortran
+compiler has support for some of the new features in Fortran 2008. This
+support is based on the latest draft, available from
+@url{http://www.nag.co.uk/sc22wg5/}. However, as the final standard may
+differ from the drafts, no guarantee of backward compatibility can be
+made and you should only use it for experimental purposes.
+
+The @uref{http://gcc.gnu.org/wiki/Fortran2008Status, wiki} has some information
+about the current Fortran 2008 implementation status.
+
+
+@c ---------------------------------------------------------------------
+@c Compiler Characteristics
+@c ---------------------------------------------------------------------
+
+@node Compiler Characteristics
+@chapter Compiler Characteristics
+
+@c TODO: Formulate this introduction a little more generally once
+@c there is more here than KIND type parameters.
+
+This chapter describes certain characteristics of the GNU Fortran compiler,
+namely the KIND type parameter values supported.
+
+@menu
+* KIND Type Parameters::
+@end menu
+
+
+@node KIND Type Parameters
+@section KIND Type Parameters
+@cindex kind
+
+The @code{KIND} type parameters supported by GNU Fortran for the primitive
+data types are:
+
+@table @code
+
+@item INTEGER
+1, 2, 4, 8*, 16*, default: 4 (1)
+
+@item LOGICAL
+1, 2, 4, 8*, 16*, default: 4 (1)
+
+@item REAL
+4, 8, 10**, 16**, default: 4 (2)
+
+@item COMPLEX
+4, 8, 10**, 16**, default: 4 (2)
+
+@item CHARACTER
+1, 4, default: 1
+
+@end table
+
+@noindent
+* = not available on all systems @*
+** = not available on all systems; additionally 10 and 16 are never
+available at the same time @*
+(1) Unless -fdefault-integer-8 is used @*
+(2) Unless -fdefault-real-8 is used
+
+@noindent
+The @code{KIND} value matches the storage size in bytes, except for
+@code{COMPLEX} where the storage size is twice as much (or both real and
+imaginary part are a real value of the given size).  It is recommended to use
+the @code{SELECT_*_KIND} intrinsics instead of the concrete values.
+
+
 @c ---------------------------------------------------------------------
 @c Extensions
 @c ---------------------------------------------------------------------
@@ -877,7 +1022,24 @@ BOZ as argument of INT, REAL, DBLE and CMPLX.
 
 @node Extensions
 @chapter Extensions
-@cindex Extension
+@cindex extensions
+
+The two sections below detail the extensions to standard Fortran that are
+implemented in GNU Fortran, as well as some of the popular or
+historically important extensions that are not (or not yet) implemented.
+For the latter case, we explain the alternatives available to GNU Fortran
+users, including replacement by standard-conforming code or GNU
+extensions.
+
+@menu
+* Extensions implemented in GNU Fortran::
+* Extensions not implemented in GNU Fortran::
+@end menu
+
+
+@node Extensions implemented in GNU Fortran
+@section Extensions implemented in GNU Fortran
+@cindex extensions, implemented
 
 GNU Fortran implements a number of extensions over standard
 Fortran. This chapter contains information on their syntax and
@@ -887,8 +1049,9 @@ by any standard, and those that are supported by GNU Fortran
 purely for backward compatibility with legacy compilers.  By default,
 @option{-std=gnu} allows the compiler to accept both types of
 extensions, but to warn about the use of the latter.  Specifying
-either @option{-std=f95} or @option{-std=f2003} disables both types
-of extensions, and @option{-std=legacy} allows both without warning.
+either @option{-std=f95}, @option{-std=f2003} or @option{-std=f2008}
+disables both types of extensions, and @option{-std=legacy} allows both
+without warning.
 
 @menu
 * Old-style kind specifications::
@@ -910,7 +1073,7 @@ of extensions, and @option{-std=legacy} allows both without warning.
 @end menu
 
 @node Old-style kind specifications
-@section Old-style kind specifications
+@subsection Old-style kind specifications
 @cindex kind, old-style
 
 GNU Fortran allows old-style kind specifications in declarations. These
@@ -930,11 +1093,17 @@ equivalent to the standard-conforming declaration
       TYPESPEC(k) x,y,z
 @end smallexample
 @noindent
-where @code{k} is equal to @code{size} for most types, but is equal to
-@code{size/2} for the @code{COMPLEX} type.
+where @code{k} is the kind parameter suitable for the intended precision.  As
+kind parameters are implementation-dependent, use the @code{KIND},
+@code{SELECTED_INT_KIND} and @code{SELECTED_REAL_KIND} intrinsics to retrieve
+the correct value, for instance @code{REAL*8 x} can be replaced by:
+@smallexample
+INTEGER, PARAMETER :: dbl = KIND(1.0d0)
+REAL(KIND=dbl) :: x
+@end smallexample
 
 @node Old-style variable initialization
-@section Old-style variable initialization
+@subsection Old-style variable initialization
 
 GNU Fortran allows old-style initialization of variables of the
 form:
@@ -968,7 +1137,7 @@ or in @code{DATA} statements automatically acquire the @code{SAVE}
 attribute.
 
 @node Extensions to namelist
-@section Extensions to namelist
+@subsection Extensions to namelist
 @cindex Namelist
 
 GNU Fortran fully supports the Fortran 95 standard for namelist I/O
@@ -1037,7 +1206,7 @@ elements will be given the values 1.00 and 2.00.
 @end smallexample
 
 @node X format descriptor without count field
-@section @code{X} format descriptor without count field
+@subsection @code{X} format descriptor without count field
 
 To support legacy codes, GNU Fortran permits the count field of the
 @code{X} edit descriptor in @code{FORMAT} statements to be omitted.
@@ -1049,7 +1218,7 @@ When omitted, the count is implicitly assumed to be one.
 @end smallexample
 
 @node Commas in FORMAT specifications
-@section Commas in @code{FORMAT} specifications
+@subsection Commas in @code{FORMAT} specifications
 
 To support legacy codes, GNU Fortran allows the comma separator
 to be omitted immediately before and after character string edit
@@ -1062,7 +1231,7 @@ descriptors in @code{FORMAT} statements.
 
 
 @node Missing period in FORMAT specifications
-@section Missing period in @code{FORMAT} specifications
+@subsection Missing period in @code{FORMAT} specifications
 
 To support legacy codes, GNU Fortran allows missing periods in format
 specifications if and only if @option{-std=legacy} is given on the
@@ -1076,7 +1245,7 @@ discouraged.
 @end smallexample
 
 @node I/O item lists
-@section I/O item lists
+@subsection I/O item lists
 @cindex I/O item lists
 
 To support legacy codes, GNU Fortran allows the input item list
@@ -1084,7 +1253,7 @@ of the @code{READ} statement, and the output item lists of the
 @code{WRITE} and @code{PRINT} statements, to start with a comma.
 
 @node BOZ literal constants
-@section BOZ literal constants
+@subsection BOZ literal constants
 @cindex BOZ literal constants
 
 Besides decimal constants, Fortran also supports binary (@code{b}),
@@ -1101,8 +1270,8 @@ are also allowed as argument of @code{REAL}, @code{DBLE}, @code{INT}
 and @code{CMPLX}; the result is the same as if the integer BOZ
 literal had been converted by @code{TRANSFER} to, respectively,
 @code{real}, @code{double precision}, @code{integer} or @code{complex}.
-The GNU Fortran intrinsic procedure @code{FLOAT}, @code{DFLOAT},
-@code{COMPLEX} and @code{DCMPLX} are treated alike.
+As GNU Fortran extension the intrinsic procedures @code{FLOAT},
+@code{DFLOAT}, @code{COMPLEX} and @code{DCMPLX} are treated alike.
 
 As an extension, GNU Fortran allows hexadecimal BOZ literal constants to
 be specified using the @code{X} prefix, in addition to the standard
@@ -1115,11 +1284,12 @@ DATA statements and the four intrinsic functions allowed by Fortran 2003.
 In DATA statements, in direct assignments, where the right-hand side
 only contains a BOZ literal constant, and for old-style initializers of
 the form @code{integer i /o'0173'/}, the constant is transferred
-as if @code{TRANSFER} had been used. In all other cases, the BOZ literal
-constant is converted to an @code{INTEGER} value with
+as if @code{TRANSFER} had been used; for @code{COMPLEX} numbers, only
+the real part is initialized unless @code{CMPLX} is used. In all other
+cases, the BOZ literal constant is converted to an @code{INTEGER} value with
 the largest decimal representation.  This value is then converted
 numerically to the type and kind of the variable in question.
-(For instance @code{real :: r = b'0000001' + 1} initializes @code{r}
+(For instance, @code{real :: r = b'0000001' + 1} initializes @code{r}
 with @code{2.0}.) As different compilers implement the extension
 differently, one should be careful when doing bitwise initialization
 of non-integer variables.
@@ -1132,14 +1302,14 @@ option can be used as a workaround for legacy code that initializes
 integers in this manner.
 
 @node Real array indices
-@section Real array indices
+@subsection Real array indices
 @cindex array, indices of type real
 
 As an extension, GNU Fortran allows the use of @code{REAL} expressions
 or variables as array indices.
 
 @node Unary operators
-@section Unary operators
+@subsection Unary operators
 @cindex operators, unary
 
 As an extension, GNU Fortran allows unary plus and unary minus operators
@@ -1151,7 +1321,7 @@ the need for parenthesis.
 @end smallexample
 
 @node Implicitly convert LOGICAL and INTEGER values
-@section Implicitly convert @code{LOGICAL} and @code{INTEGER} values
+@subsection Implicitly convert @code{LOGICAL} and @code{INTEGER} values
 @cindex conversion, to integer
 @cindex conversion, to logical
 
@@ -1164,15 +1334,20 @@ zero, and @code{.TRUE.} is interpreted as one.  When converting from
 @code{.FALSE.} and any nonzero value is interpreted as @code{.TRUE.}.
 
 @smallexample
-       INTEGER :: i = 1
-       IF (i) PRINT *, 'True'
+        LOGICAL :: l
+        l = 1
+@end smallexample
+@smallexample
+        INTEGER :: i
+        i = .TRUE.
 @end smallexample
 
-However, there is no implicit conversion of @code{LOGICAL} and
-@code{INTEGER} values performed during I/O operations.
+However, there is no implicit conversion of @code{INTEGER} values in
+@code{if}-statements, nor of @code{LOGICAL} or @code{INTEGER} values
+in I/O operations.
 
 @node Hollerith constants support
-@section Hollerith constants support
+@subsection Hollerith constants support
 @cindex Hollerith constants
 
 GNU Fortran supports Hollerith constants in assignments, function
@@ -1214,8 +1389,8 @@ obtained by using the @code{TRANSFER} statement, as in this example.
 
 
 @node Cray pointers
-@section Cray pointers
-@cindex pointer, cray
+@subsection Cray pointers
+@cindex pointer, Cray
 
 Cray pointers are part of a non-standard extension that provides a
 C-like pointer in Fortran.  This is accomplished through a pair of
@@ -1342,8 +1517,8 @@ variables in the invoked function.  Subsequent changes to the pointer
 will not change the base address of the array that was passed.
 
 @node CONVERT specifier
-@section CONVERT specifier
-@cindex CONVERT specifier
+@subsection @code{CONVERT} specifier
+@cindex @code{CONVERT} specifier
 
 GNU Fortran allows the conversion of unformatted data between little-
 and big-endian representation to facilitate moving of data
@@ -1357,9 +1532,9 @@ Valid values for @code{CONVERT} are:
 @item @code{CONVERT='NATIVE'} Use the native format.  This is the default.
 @item @code{CONVERT='SWAP'} Swap between little- and big-endian.
 @item @code{CONVERT='LITTLE_ENDIAN'} Use the little-endian representation
-        for unformatted files.
+for unformatted files.
 @item @code{CONVERT='BIG_ENDIAN'} Use the big-endian representation for
-        unformatted files.
+unformatted files.
 @end itemize
 
 Using the option could look like this:
@@ -1391,28 +1566,70 @@ to you, it is best if you use this only for data that needs to be
 portable.
 
 @node OpenMP
-@section OpenMP
+@subsection OpenMP
 @cindex OpenMP
 
-GNU Fortran attempts to be OpenMP Application Program Interface v2.5
-compatible when invoked with the @option{-fopenmp} option.  GNU Fortran
-then generates parallelized code according to the OpenMP directives
-used in the source.  The OpenMP Fortran runtime library
-routines are provided both in a form of a Fortran 90 module named
-@code{omp_lib} and in a form of a Fortran @code{include} file named
-@file{omp_lib.h}.
+OpenMP (Open Multi-Processing) is an application programming
+interface (API) that supports multi-platform shared memory 
+multiprocessing programming in C/C++ and Fortran on many 
+architectures, including Unix and Microsoft Windows platforms.
+It consists of a set of compiler directives, library routines,
+and environment variables that influence run-time behavior.
+
+GNU Fortran strives to be compatible to the 
+@uref{http://www.openmp.org/mp-documents/spec30.pdf,
+OpenMP Application Program Interface v3.0}.
+
+To enable the processing of the OpenMP directive @code{!$omp} in
+free-form source code; the @code{c$omp}, @code{*$omp} and @code{!$omp}
+directives in fixed form; the @code{!$} conditional compilation sentinels
+in free form; and the @code{c$}, @code{*$} and @code{!$} sentinels
+in fixed form, @command{gfortran} needs to be invoked with the
+@option{-fopenmp}. This also arranges for automatic linking of the
+GNU OpenMP runtime library @ref{Top,,libgomp,libgomp,GNU OpenMP
+runtime library}.
+
+The OpenMP Fortran runtime library routines are provided both in a
+form of a Fortran 90 module named @code{omp_lib} and in a form of
+a Fortran @code{include} file named @file{omp_lib.h}.
+
+An example of a parallelized loop taken from Appendix A.1 of
+the OpenMP Application Program Interface v2.5:
+@smallexample
+SUBROUTINE A1(N, A, B)
+  INTEGER I, N
+  REAL B(N), A(N)
+!$OMP PARALLEL DO !I is private by default
+  DO I=2,N
+    B(I) = (A(I) + A(I-1)) / 2.0
+  ENDDO
+!$OMP END PARALLEL DO
+END SUBROUTINE A1
+@end smallexample
+
+Please note:
+@itemize
+@item
+@option{-fopenmp} implies @option{-frecursive}, i.e., all local arrays
+will be allocated on the stack. When porting existing code to OpenMP,
+this may lead to surprising results, especially to segmentation faults
+if the stacksize is limited.
 
-For details refer to the actual
-@uref{http://www.openmp.org/drupal/mp-documents/spec25.pdf,
-OpenMP Application Program Interface v2.5} specification and to the
-@ref{Top,,Introduction,libgomp,GNU OpenMP runtime library}.
+@item
+On glibc-based systems, OpenMP enabled applications cannot be statically
+linked due to limitations of the underlying pthreads-implementation. It
+might be possible to get a working solution if 
+@command{-Wl,--whole-archive -lpthread -Wl,--no-whole-archive} is added
+to the command line. However, this is not supported by @command{gcc} and
+thus not recommended.
+@end itemize
 
 @node Argument list functions
-@section Argument list functions %VAL, %REF and %LOC
+@subsection Argument list functions @code{%VAL}, @code{%REF} and @code{%LOC}
 @cindex argument list functions
-@cindex %VAL
-@cindex %REF
-@cindex %LOC
+@cindex @code{%VAL}
+@cindex @code{%REF}
+@cindex @code{%LOC}
 
 GNU Fortran supports argument list functions @code{%VAL}, @code{%REF} 
 and @code{%LOC} statements, for backward compatibility with g77. 
@@ -1428,7 +1645,7 @@ are rebuilt using a new compiler or version of a compiler.
 @code{%VAL} passes a scalar argument by value, @code{%REF} passes it by 
 reference and @code{%LOC} passes its memory location.  Since gfortran 
 already passes scalar arguments by reference, @code{%REF} is in effect 
-a do-nothing.  @code{%LOC} has the same effect as a fortran pointer.
+a do-nothing.  @code{%LOC} has the same effect as a Fortran pointer.
 
 An example of passing an argument by value to a C subroutine foo.:
 @smallexample
 For details refer to the g77 manual
 @uref{http://gcc.gnu.org/onlinedocs/gcc-3.4.6/g77/index.html#Top}.
 
-Also, the gfortran testsuite c_by_val.f and its partner c_by_val.c are
-worth a look.
+Also, @code{c_by_val.f} and its partner @code{c_by_val.c} of the
+GNU Fortran testsuite are worth a look.
+
+
+@node Extensions not implemented in GNU Fortran
+@section Extensions not implemented in GNU Fortran
+@cindex extensions, not implemented
+
+The long history of the Fortran language, its wide use and broad
+userbase, the large number of different compiler vendors and the lack of
+some features crucial to users in the first standards have lead to the
+existence of a number of important extensions to the language.  While
+some of the most useful or popular extensions are supported by the GNU
+Fortran compiler, not all existing extensions are supported.  This section
+aims at listing these extensions and offering advice on how best make
+code that uses them running with the GNU Fortran compiler.
+
+@c More can be found here:
+@c   -- http://gcc.gnu.org/onlinedocs/gcc-3.4.6/g77/Missing-Features.html
+@c   -- the list of Fortran and libgfortran bugs closed as WONTFIX:
+@c      http://tinyurl.com/2u4h5y
+
+@menu
+* STRUCTURE and RECORD::
+@c * UNION and MAP::
+* ENCODE and DECODE statements::
+* Variable FORMAT expressions::
+@c * Q edit descriptor::
+@c * AUTOMATIC statement::
+@c * TYPE and ACCEPT I/O Statements::
+@c * .XOR. operator::
+@c * CARRIAGECONTROL, DEFAULTFILE, DISPOSE and RECORDTYPE I/O specifiers::
+@c * Omitted arguments in procedure call:
+@end menu
+
+
+@node STRUCTURE and RECORD
+@subsection @code{STRUCTURE} and @code{RECORD}
+@cindex @code{STRUCTURE}
+@cindex @code{RECORD}
+
+Structures are user-defined aggregate data types; this functionality was
+standardized in Fortran 90 with an different syntax, under the name of
+``derived types''. Here is an example of code using the non portable
+structure syntax:
+
+@example
+! Declaring a structure named ``item'' and containing three fields:
+! an integer ID, an description string and a floating-point price.
+STRUCTURE /item/
+  INTEGER id
+  CHARACTER(LEN=200) description
+  REAL price
+END STRUCTURE
+
+! Define two variables, an single record of type ``item''
+! named ``pear'', and an array of items named ``store_catalog''
+RECORD /item/ pear, store_catalog(100)
+
+! We can directly access the fields of both variables
+pear.id = 92316
+pear.description = "juicy D'Anjou pear"
+pear.price = 0.15
+store_catalog(7).id = 7831
+store_catalog(7).description = "milk bottle"
+store_catalog(7).price = 1.2
+
+! We can also manipulate the whole structure
+store_catalog(12) = pear
+print *, store_catalog(12)
+@end example
+
+@noindent
+This code can easily be rewritten in the Fortran 90 syntax as following:
+
+@example
+! ``STRUCTURE /name/ ... END STRUCTURE'' becomes
+! ``TYPE name ... END TYPE''
+TYPE item
+  INTEGER id
+  CHARACTER(LEN=200) description
+  REAL price
+END TYPE
+
+! ``RECORD /name/ variable'' becomes ``TYPE(name) variable''
+TYPE(item) pear, store_catalog(100)
+
+! Instead of using a dot (.) to access fields of a record, the
+! standard syntax uses a percent sign (%)
+pear%id = 92316
+pear%description = "juicy D'Anjou pear"
+pear%price = 0.15
+store_catalog(7)%id = 7831
+store_catalog(7)%description = "milk bottle"
+store_catalog(7)%price = 1.2
+
+! Assignments of a whole variable don't change
+store_catalog(12) = pear
+print *, store_catalog(12)
+@end example
+
+
+@c @node UNION and MAP
+@c @subsection @code{UNION} and @code{MAP}
+@c @cindex @code{UNION}
+@c @cindex @code{MAP}
+@c
+@c For help writing this one, see
+@c http://www.eng.umd.edu/~nsw/ench250/fortran1.htm#UNION and
+@c http://www.tacc.utexas.edu/services/userguides/pgi/pgiws_ug/pgi32u06.htm
+
+
+@node ENCODE and DECODE statements
+@subsection @code{ENCODE} and @code{DECODE} statements
+@cindex @code{ENCODE}
+@cindex @code{DECODE}
+
+GNU Fortran doesn't support the @code{ENCODE} and @code{DECODE}
+statements.  These statements are best replaced by @code{READ} and
+@code{WRITE} statements involving internal files (@code{CHARACTER}
+variables and arrays), which have been part of the Fortran standard since
+Fortran 77. For example, replace a code fragment like
+
+@smallexample
+      INTEGER*1 LINE(80)
+      REAL A, B, C
+c     ... Code that sets LINE
+      DECODE (80, 9000, LINE) A, B, C
+ 9000 FORMAT (1X, 3(F10.5))
+@end smallexample
+
+@noindent
+with the following:
+
+@smallexample
+      CHARACTER(LEN=80) LINE
+      REAL A, B, C
+c     ... Code that sets LINE
+      READ (UNIT=LINE, FMT=9000) A, B, C
+ 9000 FORMAT (1X, 3(F10.5))
+@end smallexample
+
+Similarly, replace a code fragment like
+
+@smallexample
+      INTEGER*1 LINE(80)
+      REAL A, B, C
+c     ... Code that sets A, B and C
+      ENCODE (80, 9000, LINE) A, B, C
+ 9000 FORMAT (1X, 'OUTPUT IS ', 3(F10.5))
+@end smallexample
+
+@noindent
+with the following:
+
+@smallexample
+      CHARACTER(LEN=80) LINE
+      REAL A, B, C
+c     ... Code that sets A, B and C
+      WRITE (UNIT=LINE, FMT=9000) A, B, C
+ 9000 FORMAT (1X, 'OUTPUT IS ', 3(F10.5))
+@end smallexample
+
+
+@node Variable FORMAT expressions
+@subsection Variable @code{FORMAT} expressions
+@cindex @code{FORMAT}
+
+A variable @code{FORMAT} expression is format statement which includes
+angle brackets enclosing a Fortran expression: @code{FORMAT(I<N>)}. GNU
+Fortran does not support this legacy extension. The effect of variable
+format expressions can be reproduced by using the more powerful (and
+standard) combination of internal output and string formats. For example,
+replace a code fragment like this:
+
+@smallexample
+      WRITE(6,20) INT1
+ 20   FORMAT(I<N+1>)
+@end smallexample
+
+@noindent
+with the following:
+
+@smallexample
+c     Variable declaration
+      CHARACTER(LEN=20) F
+c     
+c     Other code here...
+c
+      WRITE(FMT,'("(I", I0, ")")') N+1
+      WRITE(6,FM) INT1
+@end smallexample
+
+@noindent
+or with:
+
+@smallexample
+c     Variable declaration
+      CHARACTER(LEN=20) FMT
+c     
+c     Other code here...
+c
+      WRITE(FMT,*) N+1
+      WRITE(6,"(I" // ADJUSTL(FMT) // ")") INT1
+@end smallexample
+
 
 @c ---------------------------------------------------------------------
+@c Mixed-Language Programming
+@c ---------------------------------------------------------------------
+
+@node Mixed-Language Programming
+@chapter Mixed-Language Programming
+@cindex Interoperability
+@cindex Mixed-language programming
+
+@menu
+* Interoperability with C::
+* GNU Fortran Compiler Directives::
+* Non-Fortran Main Program::
+@end menu
+
+This chapter is about mixed-language interoperability, but also applies
+if one links Fortran code compiled by different compilers. In most cases,
+use of the C Binding features of the Fortran 2003 standard is sufficient,
+and their use is highly recommended.
+
+
+@node Interoperability with C
+@section Interoperability with C
+
+@menu
+* Intrinsic Types::
+* Further Interoperability of Fortran with C::
+* Derived Types and struct::
+* Interoperable Global Variables::
+* Interoperable Subroutines and Functions::
+@end menu
+
+Since Fortran 2003 (ISO/IEC 1539-1:2004(E)) there is a
+standardized way to generate procedure and derived-type
+declarations and global variables which are interoperable with C
+(ISO/IEC 9899:1999). The @code{bind(C)} attribute has been added
+to inform the compiler that a symbol shall be interoperable with C;
+also, some constraints are added. Note, however, that not
+all C features have a Fortran equivalent or vice versa. For instance,
+neither C's unsigned integers nor C's functions with variable number
+of arguments have an equivalent in Fortran.
+
+
+@node Intrinsic Types
+@subsection Intrinsic Types
+
+In order to ensure that exactly the same variable type and kind is used
+in C and Fortran, the named constants shall be used which are defined in the
+@code{ISO_C_BINDING} intrinsic module. That module contains named constants
+for kind parameters and character named constants for the escape sequences
+in C. For a list of the constants, see @ref{ISO_C_BINDING}.
+
+@node Derived Types and struct
+@subsection Derived Types and struct
+
+For compatibility of derived types with @code{struct}, one needs to use
+the @code{BIND(C)} attribute in the type declaration. For instance, the
+following type declaration
+
+@smallexample
+ USE ISO_C_BINDING
+ TYPE, BIND(C) :: myType
+   INTEGER(C_INT) :: i1, i2
+   INTEGER(C_SIGNED_CHAR) :: i3
+   REAL(C_DOUBLE) :: d1
+   COMPLEX(C_FLOAT_COMPLEX) :: c1
+   CHARACTER(KIND=C_CHAR) :: str(5)
+ END TYPE
+@end smallexample
+
+matches the following @code{struct} declaration in C
+
+@smallexample
+ struct @{
+   int i1, i2;
+   /* Note: "char" might be signed or unsigned.  */
+   signed char i3;
+   double d1;
+   float _Complex c1;
+   char str[5];
+ @} myType;
+@end smallexample
+
+Derived types with the C binding attribute shall not have the @code{sequence}
+attribute, type parameters, the @code{extends} attribute, nor type-bound
+procedures. Every component must be of interoperable type and kind and may not
+have the @code{pointer} or @code{allocatable} attribute. The names of the
+variables are irrelevant for interoperability.
+
+As there exist no direct Fortran equivalents, neither unions nor structs
+with bit field or variable-length array members are interoperable.
+
+@node Interoperable Global Variables
+@subsection Interoperable Global Variables
+
+Variables can be made accessible from C using the C binding attribute,
+optionally together with specifying a binding name. Those variables
+have to be declared in the declaration part of a @code{MODULE},
+be of interoperable type, and have neither the @code{pointer} nor
+the @code{allocatable} attribute.
+
+@smallexample
+  MODULE m
+    USE myType_module
+    USE ISO_C_BINDING
+    integer(C_INT), bind(C, name="_MyProject_flags") :: global_flag
+    type(myType), bind(C) :: tp
+  END MODULE
+@end smallexample
+
+Here, @code{_MyProject_flags} is the case-sensitive name of the variable
+as seen from C programs while @code{global_flag} is the case-insensitive
+name as seen from Fortran. If no binding name is specified, as for
+@var{tp}, the C binding name is the (lowercase) Fortran binding name.
+If a binding name is specified, only a single variable may be after the
+double colon. Note of warning: You cannot use a global variable to
+access @var{errno} of the C library as the C standard allows it to be
+a macro. Use the @code{IERRNO} intrinsic (GNU extension) instead.
+
+@node Interoperable Subroutines and Functions
+@subsection Interoperable Subroutines and Functions
+
+Subroutines and functions have to have the @code{BIND(C)} attribute to
+be compatible with C. The dummy argument declaration is relatively
+straightforward. However, one needs to be careful because C uses
+call-by-value by default while Fortran behaves usually similar to
+call-by-reference. Furthermore, strings and pointers are handled
+differently. Note that only explicit size and assumed-size arrays are
+supported but not assumed-shape or allocatable arrays.
+
+To pass a variable by value, use the @code{VALUE} attribute.
+Thus the following C prototype
+
+@smallexample
+@code{int func(int i, int *j)}
+@end smallexample
+
+matches the Fortran declaration
+
+@smallexample
+  integer(c_int) function func(i,j)
+    use iso_c_binding, only: c_int
+    integer(c_int), VALUE :: i
+    integer(c_int) :: j
+@end smallexample
+
+Note that pointer arguments also frequently need the @code{VALUE} attribute.
+
+Strings are handled quite differently in C and Fortran. In C a string
+is a @code{NUL}-terminated array of characters while in Fortran each string
+has a length associated with it and is thus not terminated (by e.g.
+@code{NUL}). For example, if one wants to use the following C function,
+
+@smallexample
+  #include <stdio.h>
+  void print_C(char *string) /* equivalent: char string[]  */
+  @{
+     printf("%s\n", string);
+  @}
+@end smallexample
+
+to print ``Hello World'' from Fortran, one can call it using
+
+@smallexample
+  use iso_c_binding, only: C_CHAR, C_NULL_CHAR
+  interface
+    subroutine print_c(string) bind(C, name="print_C")
+      use iso_c_binding, only: c_char
+      character(kind=c_char) :: string(*)
+    end subroutine print_c
+  end interface
+  call print_c(C_CHAR_"Hello World"//C_NULL_CHAR)
+@end smallexample
+
+As the example shows, one needs to ensure that the
+string is @code{NUL} terminated. Additionally, the dummy argument
+@var{string} of @code{print_C} is a length-one assumed-size
+array; using @code{character(len=*)} is not allowed. The example
+above uses @code{c_char_"Hello World"} to ensure the string
+literal has the right type; typically the default character
+kind and @code{c_char} are the same and thus @code{"Hello World"}
+is equivalent. However, the standard does not guarantee this.
+
+The use of pointers is now illustrated using the C library
+function @code{strncpy}, whose prototype is
+
+@smallexample
+  char *strncpy(char *restrict s1, const char *restrict s2, size_t n);
+@end smallexample
+
+The function @code{strncpy} copies at most @var{n} characters from
+string @var{s2} to @var{s1} and returns @var{s1}. In the following
+example, we ignore the return value:
+
+@smallexample
+  use iso_c_binding
+  implicit none
+  character(len=30) :: str,str2
+  interface
+    ! Ignore the return value of strncpy -> subroutine
+    ! "restrict" is always assumed if we do not pass a pointer
+    subroutine strncpy(dest, src, n) bind(C)
+      import
+      character(kind=c_char),  intent(out) :: dest(*)
+      character(kind=c_char),  intent(in)  :: src(*)
+      integer(c_size_t), value, intent(in) :: n
+    end subroutine strncpy
+  end interface
+  str = repeat('X',30) ! Initialize whole string with 'X'
+  call strncpy(str, c_char_"Hello World"//C_NULL_CHAR, &
+               len(c_char_"Hello World",kind=c_size_t))
+  print '(a)', str ! prints: "Hello WorldXXXXXXXXXXXXXXXXXXX"
+  end
+@end smallexample
+
+C pointers are represented in Fortran via the special derived type
+@code{type(c_ptr)}, with private components. Thus one needs to
+use intrinsic conversion procedures to convert from or to C pointers.
+For example,
+
+@smallexample
+  use iso_c_binding
+  type(c_ptr) :: cptr1, cptr2
+  integer, target :: array(7), scalar
+  integer, pointer :: pa(:), ps
+  cptr1 = c_loc(array(1)) ! The programmer needs to ensure that the
+                          ! array is contiguous if required by the C
+                          ! procedure
+  cptr2 = c_loc(scalar)
+  call c_f_pointer(cptr2, ps)
+  call c_f_pointer(cptr2, pa, shape=[7])
+@end smallexample
+
+When converting C to Fortran arrays, the one-dimensional @code{SHAPE} argument
+has to be passed. Note: A pointer argument @code{void *} matches
+@code{TYPE(C_PTR), VALUE} while @code{TYPE(C_PTR)} matches @code{void **}.
+
+Procedure pointers are handled analogously to pointers; the C type is
+@code{TYPE(C_FUNPTR)} and the intrinsic conversion procedures are
+@code{C_F_PROC_POINTER} and @code{C_FUNLOC}.
+
+The intrinsic procedures are described in @ref{Intrinsic Procedures}.
+
+@node Further Interoperability of Fortran with C
+@subsection Further Interoperability of Fortran with C
+
+Assumed-shape and allocatable arrays are passed using an array descriptor
+(dope vector). The internal structure of the array descriptor used
+by GNU Fortran is not yet documented and will change. There will also be
+a Technical Report (TR 29113) which standardizes an interoperable
+array descriptor. Until then, you can use the Chasm Language
+Interoperability Tools, @url{http://chasm-interop.sourceforge.net/},
+which provide an interface to GNU Fortran's array descriptor.
+
+The technical report 29113 will presumably also include support for
+C-interoperable @code{OPTIONAL} and for assumed-rank and assumed-type
+dummy arguments. However, the TR has neither been approved nor implemented
+in GNU Fortran; therefore, these features are not yet available.
+
+
+
+@node GNU Fortran Compiler Directives
+@section GNU Fortran Compiler Directives
+
+The Fortran standard standard describes how a conforming program shall
+behave; however, the exact implementation is not standardized. In order
+to allow the user to choose specific implementation details, compiler
+directives can be used to set attributes of variables and procedures
+which are not part of the standard. Whether a given attribute is
+supported and its exact effects depend on both the operating system and
+on the processor; see
+@ref{Top,,C Extensions,gcc,Using the GNU Compiler Collection (GCC)}
+for details.
+
+For procedures and procedure pointers, the following attributes can
+be used to change the calling convention:
+
+@itemize
+@item @code{CDECL} -- standard C calling convention
+@item @code{STDCALL} -- convention where the called procedure pops the stack
+@item @code{FASTCALL} -- part of the arguments are passed via registers
+instead using the stack
+@end itemize
+
+Besides changing the calling convention, the attributes also influence
+the decoration of the symbol name, e.g., by a leading underscore or by
+a trailing at-sign followed by the number of bytes on the stack. When
+assigning a procedure to a procedure pointer, both should use the same
+calling convention.
+
+On some systems, procedures and global variables (module variables and
+@code{COMMON} blocks) need special handling to be accessible when they
+are in a shared library. The following attributes are available:
+
+@itemize
+@item @code{DLLEXPORT} -- provide a global pointer to a pointer in the DLL
+@item @code{DLLIMPORT} -- reference the function or variable using a global pointer 
+@end itemize
+
+The attributes are specified using the syntax
+
+@code{!GCC$ ATTRIBUTES} @var{attribute-list} @code{::} @var{variable-list}
+
+where in free-form source code only whitespace is allowed before @code{!GCC$}
+and in fixed-form source code @code{!GCC$}, @code{cGCC$} or @code{*GCC$} shall
+start in the first column.
+
+For procedures, the compiler directives shall be placed into the body
+of the procedure; for variables and procedure pointers, they shall be in
+the same declaration part as the variable or procedure pointer.
+
+
+
+@node Non-Fortran Main Program
+@section Non-Fortran Main Program
+
+@menu
+* _gfortran_set_args:: Save command-line arguments
+* _gfortran_set_options:: Set library option flags
+* _gfortran_set_convert:: Set endian conversion
+* _gfortran_set_record_marker:: Set length of record markers
+* _gfortran_set_max_subrecord_length:: Set subrecord length
+@end menu
+
+Even if you are doing mixed-language programming, it is very
+likely that you do not need to know or use the information in this
+section. Since it is about the internal structure of GNU Fortran,
+it may also change in GCC minor releases.
+
+When you compile a @code{PROGRAM} with GNU Fortran, a function
+with the name @code{main} (in the symbol table of the object file)
+is generated, which initializes the libgfortran library and then
+calls the actual program which uses the name @code{MAIN__}, for
+historic reasons. If you link GNU Fortran compiled procedures
+to, e.g., a C or C++ program or to a Fortran program compiled by
+a different compiler, the libgfortran library is not initialized
+and thus a few intrinsic procedures do not work properly, e.g.
+those for obtaining the command-line arguments.
+
+Therefore, if your @code{PROGRAM} is not compiled with
+GNU Fortran and the GNU Fortran compiled procedures require
+intrinsics relying on the library initialization, you need to
+initialize the library yourself. Using the default options,
+gfortran calls @code{_gfortran_set_args} and
+@code{_gfortran_set_options}. The initialization of the former
+is needed if the called procedures access the command line
+(and for backtracing); the latter sets some flags based on the
+standard chosen or to enable backtracing. In typical programs,
+it is not necessary to call any initialization function.
+
+If your @code{PROGRAM} is compiled with GNU Fortran, you shall
+not call any of the following functions. The libgfortran
+initialization functions are shown in C syntax but using C
+bindings they are also accessible from Fortran.
+
+
+@node _gfortran_set_args
+@subsection @code{_gfortran_set_args} --- Save command-line arguments
+@fnindex _gfortran_set_args
+@cindex libgfortran initialization, set_args
+
+@table @asis
+@item @emph{Description}:
+@code{_gfortran_set_args} saves the command-line arguments; this
+initialization is required if any of the command-line intrinsics
+is called. Additionally, it shall be called if backtracing is
+enabled (see @code{_gfortran_set_options}).
+
+@item @emph{Syntax}:
+@code{void _gfortran_set_args (int argc, char *argv[])}
+
+@item @emph{Arguments}:
+@multitable @columnfractions .15 .70
+@item @var{argc} @tab number of command line argument strings
+@item @var{argv} @tab the command-line argument strings; argv[0]
+is the pathname of the executable itself.
+@end multitable
+
+@item @emph{Example}:
+@smallexample
+int main (int argc, char *argv[])
+@{
+  /* Initialize libgfortran.  */
+  _gfortran_set_args (argc, argv);
+  return 0;
+@}
+@end smallexample
+@end table
+
+
+@node _gfortran_set_options
+@subsection @code{_gfortran_set_options} --- Set library option flags
+@fnindex _gfortran_set_options
+@cindex libgfortran initialization, set_options
+
+@table @asis
+@item @emph{Description}:
+@code{_gfortran_set_options} sets several flags related to the Fortran
+standard to be used, whether backtracing or core dumps should be enabled
+and whether range checks should be performed. The syntax allows for
+upward compatibility since the number of passed flags is specified; for
+non-passed flags, the default value is used. See also
+@pxref{Code Gen Options}. Please note that not all flags are actually
+used.
+
+@item @emph{Syntax}:
+@code{void _gfortran_set_options (int num, int options[])}
+
+@item @emph{Arguments}:
+@multitable @columnfractions .15 .70
+@item @var{num} @tab number of options passed
+@item @var{argv} @tab The list of flag values
+@end multitable
+
+@item @emph{option flag list}:
+@multitable @columnfractions .15 .70
+@item @var{option}[0] @tab Allowed standard; can give run-time errors
+if e.g. an input-output edit descriptor is invalid in a given standard.
+Possible values are (bitwise or-ed) @code{GFC_STD_F77} (1),
+@code{GFC_STD_F95_OBS} (2), @code{GFC_STD_F95_DEL} (4), @code{GFC_STD_F95}
+(8), @code{GFC_STD_F2003} (16), @code{GFC_STD_GNU} (32),
+@code{GFC_STD_LEGACY} (64), and @code{GFC_STD_F2008} (128).
+Default: @code{GFC_STD_F95_OBS | GFC_STD_F95_DEL | GFC_STD_F2003
+| GFC_STD_F2008 | GFC_STD_F95 | GFC_STD_F77 | GFC_STD_GNU | GFC_STD_LEGACY}.
+@item @var{option}[1] @tab Standard-warning flag; prints a warning to
+standard error. Default: @code{GFC_STD_F95_DEL | GFC_STD_LEGACY}.
+@item @var{option}[2] @tab If non zero, enable pedantic checking.
+Default: off.
+@item @var{option}[3] @tab If non zero, enable core dumps on run-time
+errors. Default: off.
+@item @var{option}[4] @tab If non zero, enable backtracing on run-time
+errors. Default: off.
+Note: Installs a signal handler and requires command-line
+initialization using @code{_gfortran_set_args}.
+@item @var{option}[5] @tab If non zero, supports signed zeros.
+Default: enabled.
+@item @var{option}[6] @tab Enables run-time checking. Possible values
+are (bitwise or-ed): GFC_RTCHECK_BOUNDS (1), GFC_RTCHECK_ARRAY_TEMPS (2),
+GFC_RTCHECK_RECURSION (4), GFC_RTCHECK_DO (16), GFC_RTCHECK_POINTER (32).
+Default: disabled.
+@item @var{option}[7] @tab If non zero, range checking is enabled.
+Default: enabled. See -frange-check (@pxref{Code Gen Options}).
+@end multitable
+
+@item @emph{Example}:
+@smallexample
+  /* Use gfortran 4.5 default options.  */
+  static int options[] = @{68, 255, 0, 0, 0, 1, 0, 1@};
+  _gfortran_set_options (8, &options);
+@end smallexample
+@end table
+
+
+@node _gfortran_set_convert
+@subsection @code{_gfortran_set_convert} --- Set endian conversion
+@fnindex _gfortran_set_convert
+@cindex libgfortran initialization, set_convert
+
+@table @asis
+@item @emph{Description}:
+@code{_gfortran_set_convert} set the representation of data for
+unformatted files.
+
+@item @emph{Syntax}:
+@code{void _gfortran_set_convert (int conv)}
+
+@item @emph{Arguments}:
+@multitable @columnfractions .15 .70
+@item @var{conv} @tab Endian conversion, possible values:
+GFC_CONVERT_NATIVE (0, default), GFC_CONVERT_SWAP (1),
+GFC_CONVERT_BIG (2), GFC_CONVERT_LITTLE (3).
+@end multitable
+
+@item @emph{Example}:
+@smallexample
+int main (int argc, char *argv[])
+@{
+  /* Initialize libgfortran.  */
+  _gfortran_set_args (argc, argv);
+  _gfortran_set_convert (1);
+  return 0;
+@}
+@end smallexample
+@end table
+
+
+@node _gfortran_set_record_marker
+@subsection @code{_gfortran_set_record_marker} --- Set length of record markers
+@fnindex _gfortran_set_record_marker
+@cindex libgfortran initialization, set_record_marker
+
+@table @asis
+@item @emph{Description}:
+@code{_gfortran_set_record_marker} set the length of record markers
+for unformatted files.
+
+@item @emph{Syntax}:
+@code{void _gfortran_set_record_marker (int val)}
+
+@item @emph{Arguments}:
+@multitable @columnfractions .15 .70
+@item @var{val} @tab Length of the record marker; valid values
+are 4 and 8. Default is 4.
+@end multitable
+
+@item @emph{Example}:
+@smallexample
+int main (int argc, char *argv[])
+@{
+  /* Initialize libgfortran.  */
+  _gfortran_set_args (argc, argv);
+  _gfortran_set_record_marker (8);
+  return 0;
+@}
+@end smallexample
+@end table
+
+
+@node _gfortran_set_max_subrecord_length
+@subsection @code{_gfortran_set_max_subrecord_length} --- Set subrecord length
+@fnindex _gfortran_set_max_subrecord_length
+@cindex libgfortran initialization, set_max_subrecord_length
+
+@table @asis
+@item @emph{Description}:
+@code{_gfortran_set_max_subrecord_length} set the maximum length
+for a subrecord. This option only makes sense for testing and
+debugging of unformatted I/O.
+
+@item @emph{Syntax}:
+@code{void _gfortran_set_max_subrecord_length (int val)}
+
+@item @emph{Arguments}:
+@multitable @columnfractions .15 .70
+@item @var{val} @tab the maximum length for a subrecord;
+the maximum permitted value is 2147483639, which is also
+the default.
+@end multitable
+
+@item @emph{Example}:
+@smallexample
+int main (int argc, char *argv[])
+@{
+  /* Initialize libgfortran.  */
+  _gfortran_set_args (argc, argv);
+  _gfortran_set_max_subrecord_length (8);
+  return 0;
+@}
+@end smallexample
+@end table
+
+
+
 @c Intrinsic Procedures
 @c ---------------------------------------------------------------------
 
@@ -1502,35 +2475,42 @@ Most of the interface with GCC was written by @emph{Paul Brook}.
 
 The following individuals have contributed code and/or
 ideas and significant help to the GNU Fortran project
-(in no particular order):
+(in alphabetical order):
 
 @itemize @minus
-@item Andy Vaught
-@item Katherine Holcomb
-@item Tobias Schl@"uter
+@item Janne Blomqvist
 @item Steven Bosscher
-@item Toon Moene
-@item Tim Prince
-@item Niels Kristian Bech Jensen
-@item Steven Johnson
 @item Paul Brook
-@item Feng Wang
-@item Bud Davis
-@item Paul Thomas
+@item Tobias Burnus
 @item Fran@,{c}ois-Xavier Coudert
-@item Steven G. Kargl
-@item Jerry Delisle
-@item Janne Blomqvist
+@item Bud Davis
+@item Jerry DeLisle
 @item Erik Edelmann
+@item Bernhard Fischer
+@item Daniel Franke
+@item Richard Guenther
+@item Richard Henderson
+@item Katherine Holcomb
+@item Jakub Jelinek
+@item Niels Kristian Bech Jensen
+@item Steven Johnson
+@item Steven G. Kargl
 @item Thomas Koenig
 @item Asher Langton
-@item Jakub Jelinek
-@item Roger Sayle
-@item H.J. Lu
-@item Richard Henderson
+@item H. J. Lu
+@item Toon Moene
+@item Brooks Moses
+@item Andrew Pinski
+@item Tim Prince
+@item Christopher D. Rickett
 @item Richard Sandiford
-@item Richard Guenther
-@item Bernhard Fischer
+@item Tobias Schl@"uter
+@item Roger Sayle
+@item Paul Thomas
+@item Andy Vaught
+@item Feng Wang
+@item Janus Weil
+@item Daniel Kraft
 @end itemize
 
 The following people have contributed bug reports,
@@ -1539,9 +2519,11 @@ and much needed feedback and encouragement for the
 GNU Fortran project: 
 
 @itemize @minus
-@item Erik Schnetter
 @item Bill Clodius
+@item Dominique d'Humi@`eres
 @item Kate Hedstrom
+@item Erik Schnetter
+@item Joost VandeVondele
 @end itemize
 
 Many other individuals have helped debug,
@@ -1558,27 +2540,19 @@ list above, please contact us.
 @table @emph
 
 @item Help build the test suite
-Solicit more code for donation to the test suite.
-We can keep code private on request.
+Solicit more code for donation to the test suite: the more extensive the
+testsuite, the smaller the risk of breaking things in the future! We can
+keep code private on request.
 
 @item Bug hunting/squishing
-Find bugs and write more test cases!
-Test cases are especially very welcome,
-because it allows us to concentrate on fixing bugs
-instead of isolating them.
-
-@item Smaller projects (``bug'' fixes):
-  @itemize @minus
-  @item Allow init exprs to be numbers raised to integer powers.
-  @item Implement correct rounding.
-  @item Implement F restrictions on Fortran 95 syntax.
-  @item See about making Emacs-parsable error messages.
-  @end itemize
-@end table
+Find bugs and write more test cases! Test cases are especially very
+welcome, because it allows us to concentrate on fixing bugs instead of
+isolating them. Going through the bugzilla database at
+@url{http://gcc.gnu.org/bugzilla/} to reduce testcases posted there and
+add more information (for example, for which version does the testcase
+work, for which versions does it fail?) is also very helpful.
 
-If you wish to work on the runtime libraries,
-please contact a project maintainer.
-@c TODO: email!
+@end table
 
 
 @node Proposed Extensions
@@ -1619,13 +2593,6 @@ Flag to force local variables into static space.
 
 @item
 Flag to force local variables onto stack.
-
-@item
-Flag for maximum errors before ending compile.
-
-@item
-Option to initialize otherwise uninitialized integer and floating
-point variables.
 @end itemize
 
 
@@ -1679,7 +2646,7 @@ Environment variable forcing standard output to be line buffered (unix).
 @c GNU General Public License
 @c ---------------------------------------------------------------------
 
-@include gpl.texi
+@include gpl_v3.texi