OSDN Git Service

* gfortran.texi (Old-style kind specifications): Document
[pf3gnuchains/gcc-fork.git] / gcc / fortran / gfortran.texi
index e46b8cc..62889bd 100644 (file)
@@ -1,7 +1,7 @@
 \input texinfo  @c -*-texinfo-*-
 @c %**start of header
 @setfilename gfortran.info
-@set copyrights-gfortran 1999-2006
+@set copyrights-gfortran 1999-2007
 
 @include gcc-common.texi
 
@@ -151,6 +151,11 @@ Boston, MA 02110-1301, USA@*
 
 @page
 
+@c ---------------------------------------------------------------------
+@c TexInfo table of contents.
+@c ---------------------------------------------------------------------
+
+@ifnottex
 @node Top
 @top Introduction
 @cindex Introduction
@@ -171,18 +176,13 @@ not accurately reflect the status of the most recent GNU Fortran compiler.
 @comment  better formatting.
 @comment
 @menu
-Part I: About GNU Fortran
-* Getting Started::      What you should know about GNU Fortran.
-* GNU Fortran and GCC::  You can compile Fortran, C, or other programs.
-* 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.
+* Introduction::
 
-Part II: Invoking GNU Fortran
+Part I: Invoking GNU Fortran
 * Invoking GNU Fortran:: Command options supported by @command{gfortran}.
 * Runtime::              Influencing runtime behavior with environment variables.
 
-Part III: Language Reference
+Part II: Language Reference
 * Fortran 2003 status::  Fortran 2003 features supported by GNU Fortran.
 * Extensions::           Language extensions implemented by GNU Fortran.
 * Intrinsic Procedures:: Intrinsic procedures supported by GNU Fortran.
@@ -195,28 +195,50 @@ Part III: Language Reference
 * Funding::              How to help assure continued work for free software.
 * Index::                Index of this documentation.
 @end menu
-
-
-@c =====================================================================
-@c PART I: ABOUT GNU FORTRAN
-@c =====================================================================
-
-@tex
-\part{I}{About GNU Fortran}
-@end tex
+@end ifnottex
 
 @c ---------------------------------------------------------------------
-@c Getting Started
+@c Introduction
 @c ---------------------------------------------------------------------
 
-@node Getting Started
-@chapter Getting Started
+@node Introduction
+@chapter Introduction
+
+@c The following duplicates the text on the TexInfo table of contents.
+@iftex
+This manual documents the use of @command{gfortran}, the GNU Fortran
+compiler. You can find in this manual how to invoke @command{gfortran},
+as well as its features and incompatibilities.
+
+@ifset DEVELOPMENT
+@emph{Warning:} This document, and the compiler it describes, are still
+under development.  While efforts are made to keep it up-to-date, it
+might not accurately reflect the status of the most recent GNU Fortran
+compiler.
+@end ifset
+@end iftex
 
 The GNU Fortran compiler front end was
 designed initially as a free replacement for,
 or alternative to, the unix @command{f95} command;
 @command{gfortran} is the command you'll use to invoke the compiler.
 
+@menu
+* About GNU Fortran::    What you should know about the GNU Fortran compiler.
+* GNU Fortran and GCC::  You can compile Fortran, C, or other programs.
+* 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.
+@end menu
+
+
+@c ---------------------------------------------------------------------
+@c About GNU Fortran
+@c ---------------------------------------------------------------------
+
+@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.
@@ -327,51 +349,37 @@ programs will call it for you.
 @c ---------------------------------------------------------------------
 
 @node GNU Fortran and GCC
-@chapter GNU Fortran and GCC
+@section GNU Fortran and GCC
 @cindex GNU Compiler Collection
-
-GCC used to be the GNU ``C'' Compiler,
-but is now known as the @dfn{GNU Compiler Collection}.
-GCC provides the GNU system with a very versatile
-compiler middle end (shared optimization passes),
-and back ends (code generators) for many different
-computer architectures and operating systems.
-The code of the middle end and back end are shared by all
-compiler front ends that are in the GNU Compiler Collection.
-
-A GCC front end is essentially a source code parser
-and an intermediate code generator.  The code generator translates the
-semantics of the source code into a language independent form called
-@dfn{GENERIC}.
-
-The parser takes a source file written in a
-particular computer language, reads and parses it,
-and tries to make sure that the source code conforms to
-the language rules.
-Once the correctness of a program has been established,
-the compiler will build a data structure known as the
-@dfn{Abstract Syntax tree},
-or just @dfn{AST} or ``tree'' for short.
-This data structure represents the whole program
-or a subroutine or a function.
-The ``tree'' is passed to the GCC middle end,
-which will perform optimization passes on it.  The optimized AST is then 
-handed off too the back end which assembles the program unit.
-
-Different phases in this translation process can be,
-and in fact @emph{are} merged in many compiler front ends.
-GNU Fortran has a strict separation between the
-parser and code generator.
-
-The goal of the GNU Fortran project is to build a new front end for GCC.
-Specifically, a Fortran 95 front end.
-In a non-@command{gfortran} installation,
-@command{gcc} will not be able to compile Fortran source code
-(only the ``C'' front end has to be compiled if you want to build GCC,
-all other languages are optional).
-If you build GCC with @command{gfortran}, @command{gcc} will recognize
-@file{.f/.f90/.f95} source files and accepts Fortran specific
-command line options.
+@cindex GCC
+
+GNU Fortran is a part of GCC, the @dfn{GNU Compiler Collection}.  GCC
+consists of a collection of front ends for various languages, which
+translate the source code into a language-independent form called
+@dfn{GENERIC}.  This is then processed by a common middle end which
+provides optimization, and then passed to one of a collection of back
+ends which generate code for different computer architectures and
+operating systems.
+
+Functionally, this is implemented with a driver program (@command{gcc})
+which provides the command-line interface for the compiler.  It calls
+the relevant compiler front-end program (e.g., @command{f951} for
+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{.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.
+
+This manual specifically documents the Fortran front end, which handles
+the programming language's syntax and semantics.  The aspects of GCC
+which relate to the optimization passes and the back-end code generation
+are documented in the GCC manual; see 
+@ref{Top,,Introduction,gcc,Using the GNU Compiler Collection (GCC)}.
+The two manuals together provide a complete reference for the GNU
+Fortran compiler.
 
 
 @c ---------------------------------------------------------------------
@@ -379,7 +387,7 @@ command line options.
 @c ---------------------------------------------------------------------
 
 @node GNU Fortran and G77
-@chapter GNU Fortran and G77
+@section GNU Fortran and G77
 @cindex Fortran 77
 @cindex G77
 
@@ -420,7 +428,7 @@ and then build a Fortran 95 compiler out of it.
 @c ---------------------------------------------------------------------
 
 @node Project Status
-@chapter Project Status
+@section Project Status
 
 @quotation
 As soon as @command{gfortran} can parse all of the statements correctly,
@@ -480,7 +488,7 @@ future standards---in particular, Fortran 2003.
 @c ---------------------------------------------------------------------
 
 @node Standards
-@chapter Standards
+@section Standards
 @cindex Standards
 
 The GNU Fortran compiler implements
@@ -496,11 +504,11 @@ ISO/IEC 1539-1:2004 (Fortran 2003).
 
 
 @c =====================================================================
-@c PART II: INVOCATION REFERENCE
+@c PART I: INVOCATION REFERENCE
 @c =====================================================================
 
 @tex
-\part{II}{Invoking GNU Fortran}
+\part{I}{Invoking GNU Fortran}
 @end tex
 
 @c ---------------------------------------------------------------------
@@ -687,11 +695,11 @@ setting a default data representation for the whole program.  The
 
 
 @c =====================================================================
-@c PART III: LANGUAGE REFERENCE
+@c PART II: LANGUAGE REFERENCE
 @c =====================================================================
 
 @tex
-\part{III}{Language Reference}
+\part{II}{Language Reference}
 @end tex
 
 @c ---------------------------------------------------------------------
@@ -829,19 +837,21 @@ of extensions, and @option{-std=legacy} allows both without warning.
 @section Old-style kind specifications
 @cindex Kind specifications
 
-GNU Fortran allows old-style kind specifications in
-declarations. These look like:
+GNU Fortran allows old-style kind specifications in declarations. These
+look like:
 @smallexample
-      TYPESPEC*k x,y,z
+      TYPESPEC*size x,y,z
 @end smallexample
 where @code{TYPESPEC} is a basic type (@code{INTEGER}, @code{REAL},
-etc.), and where @code{k} is a valid kind number for that type. The
-statement then declares @code{x}, @code{y} and @code{z} to be of
-type @code{TYPESPEC} with kind @code{k}. This is equivalent to the
-standard conforming declaration
+etc.), and where @code{size} is a byte count corresponding to a valid
+kind for that type. The statement then declares @code{x}, @code{y} and
+@code{z} to be of type @code{TYPESPEC} with the appropriate kind. This
+is equivalent to the standard conforming declaration
 @smallexample
       TYPESPEC(k) x,y,z
 @end smallexample
+where @code{k} is equal to @code{size} for most types, but is equal to
+@code{size/2} for the @code{COMPLEX} type.
 
 @node Old-style variable initialization
 @section Old-style variable initialization
@@ -859,7 +869,7 @@ variable immediately preceding the initialization.  In other words,
 something like @code{INTEGER I,J/2,3/} is not valid.  This style of
 initialization is only allowed in declarations without double colons
 (@code{::}); the double colons were introduced in Fortran 90, which also
-introduced a standard syntax for initializating variables in type
+introduced a standard syntax for initializing variables in type
 declarations.
 
 Examples of standard-conforming code equivalent to the above example
@@ -1068,7 +1078,7 @@ zero, and @code{.TRUE.} is interpreted as one.  When converting from
 
 GNU Fortran supports Hollerith constants in assignments, function
 arguments, and @code{DATA} and @code{ASSIGN} statements.  A Hollerith
-constant is written as a string of characters preceeded by an integer
+constant is written as a string of characters preceded by an integer
 constant indicating the character count, and the letter @code{H} or
 @code{h}, and stored in bytewise fashion in a numeric (@code{INTEGER},
 @code{REAL}, or @code{complex}) or @code{LOGICAL} variable.  The