OSDN Git Service

2011-01-13 Tobias Burnus <burnus@net-b.de>
[pf3gnuchains/gcc-fork.git] / gcc / fortran / intrinsic.texi
index 5c7d463..49f1b6e 100644 (file)
@@ -86,6 +86,8 @@ Some basic guidelines for editing this document:
 * @code{CMPLX}:         CMPLX,     Complex conversion function
 * @code{COMMAND_ARGUMENT_COUNT}: COMMAND_ARGUMENT_COUNT, Get number of command line arguments
 * @code{COMPLEX}:       COMPLEX,   Complex conversion function
+* @code{COMPILER_VERSION}: COMPILER_VERSION, Compiler version string
+* @code{COMPILER_OPTIONS}: COMPILER_OPTIONS, Options passed to the compiler
 * @code{CONJG}:         CONJG,     Complex conjugate function
 * @code{COS}:           COS,       Cosine function
 * @code{COSH}:          COSH,      Hyperbolic cosine function
@@ -2363,7 +2365,7 @@ expression @code{X} occupies.
 Fortran 2008
 
 @item @emph{Class}:
-Intrinsic function
+Inquiry function of the module @code{ISO_C_BINDING}
 
 @item @emph{Syntax}:
 @code{N = C_SIZEOF(X)}
@@ -2375,7 +2377,7 @@ Intrinsic function
 
 @item @emph{Return value}:
 The return value is of type integer and of the system-dependent kind
-@var{C_SIZE_T} (from the @var{ISO_C_BINDING} module). Its value is the
+@code{C_SIZE_T} (from the @code{ISO_C_BINDING} module). Its value is the
 number of bytes occupied by the argument.  If the argument has the
 @code{POINTER} attribute, the number of bytes of the storage area pointed
 to is returned.  If the argument is of a derived type with @code{POINTER}
@@ -2719,6 +2721,92 @@ end program test_command_argument_count
 
 
 
+@node COMPILER_OPTIONS
+@section @code{COMPILER_OPTIONS} --- Options passed to the compiler
+@fnindex COMPILER_OPTIONS
+@cindex flags inquiry function
+@cindex options inquiry function
+@cindex compiler flags inquiry function
+
+@table @asis
+@item @emph{Description}:
+@code{COMPILER_OPTIONS()} returns a string with the options used for
+compiling.
+
+@item @emph{Standard}:
+Fortran 2008
+
+@item @emph{Class}:
+Inquiry function of the module @code{ISO_FORTRAN_ENV}
+
+@item @emph{Syntax}:
+@code{STR = COMPILER_OPTIONS()}
+
+@item @emph{Arguments}:
+None.
+
+@item @emph{Return value}:
+The return value is a default-kind string with system-dependent length.
+It contains the compiler flags used to compile the file, which called
+the @code{COMPILER_OPTIONS} intrinsic.
+
+@item @emph{Example}:
+@smallexample
+   use iso_fortran_env
+   print '(4a)', 'This file was compiled by ', &
+                 compiler_version(), ' using the the options ', &
+                 compiler_options()
+   end
+@end smallexample
+
+@item @emph{See also}:
+@ref{COMPILER_VERSION}, @ref{ISO_FORTRAN_ENV}
+@end table
+
+
+
+@node COMPILER_VERSION
+@section @code{COMPILER_VERSION} --- Compiler version string
+@fnindex COMPILER_VERSION
+@cindex compiler, name and version
+@cindex version of the compiler
+
+@table @asis
+@item @emph{Description}:
+@code{COMPILER_VERSION()} returns a string with the name and the
+version of the compiler.
+
+@item @emph{Standard}:
+Fortran 2008
+
+@item @emph{Class}:
+Inquiry function of the module @code{ISO_FORTRAN_ENV}
+
+@item @emph{Syntax}:
+@code{STR = COMPILER_VERSION()}
+
+@item @emph{Arguments}:
+None.
+
+@item @emph{Return value}:
+The return value is a default-kind string with system-dependent length.
+It contains the name of the compiler and its version number.
+
+@item @emph{Example}:
+@smallexample
+   use iso_fortran_env
+   print '(4a)', 'This file was compiled by ', &
+                 compiler_version(), ' using the the options ', &
+                 compiler_options()
+   end
+@end smallexample
+
+@item @emph{See also}:
+@ref{COMPILER_OPTIONS}, @ref{ISO_FORTRAN_ENV}
+@end table
+
+
+
 @node COMPLEX
 @section @code{COMPLEX} --- Complex conversion function
 @fnindex COMPLEX
@@ -5266,11 +5354,11 @@ Subroutine
 @multitable @columnfractions .15 .70
 @item @var{NUMBER} @tab Shall be a scalar of type @code{INTEGER} and of
 default kind, @math{@var{NUMBER} \geq 0}
-@item @var{VALUE}  @tab Shall be a scalar of type @code{CHARACTER}
+@item @var{VALUE}  @tab (Optional) Shall be a scalar of type @code{CHARACTER}
 and of default kind.
-@item @var{LENGTH} @tab (Option) Shall be a scalar of type @code{INTEGER}
+@item @var{LENGTH} @tab (Optional) Shall be a scalar of type @code{INTEGER}
 and of default kind.
-@item @var{STATUS} @tab (Option) Shall be a scalar of type @code{INTEGER}
+@item @var{STATUS} @tab (Optional) Shall be a scalar of type @code{INTEGER}
 and of default kind.
 @end multitable
 
@@ -5426,13 +5514,13 @@ Subroutine
 @multitable @columnfractions .15 .70
 @item @var{NAME}      @tab Shall be a scalar of type @code{CHARACTER}
 and of default kind.
-@item @var{VALUE}     @tab Shall be a scalar of type @code{CHARACTER}
+@item @var{VALUE}     @tab (Optional) Shall be a scalar of type @code{CHARACTER}
 and of default kind.
-@item @var{LENGTH}    @tab Shall be a scalar of type @code{INTEGER}
+@item @var{LENGTH}    @tab (Optional) Shall be a scalar of type @code{INTEGER}
 and of default kind.
-@item @var{STATUS}    @tab Shall be a scalar of type @code{INTEGER}
+@item @var{STATUS}    @tab (Optional) Shall be a scalar of type @code{INTEGER}
 and of default kind.
-@item @var{TRIM_NAME} @tab Shall be a scalar of type @code{LOGICAL}
+@item @var{TRIM_NAME} @tab (Optional) Shall be a scalar of type @code{LOGICAL}
 and of default kind.
 @end multitable
 
@@ -5878,7 +5966,7 @@ PROGRAM test_iall
   INTEGER(1) :: a(2)
 
   a(1) = b'00100100'
-  a(1) = b'01101010'
+  a(2) = b'01101010'
 
   ! prints 00100000
   PRINT '(b8.8)', IALL(a)
@@ -5940,7 +6028,7 @@ END PROGRAM
 
 
 @node IANY
-@section @code{IANY} --- Bitwise XOR of array elements
+@section @code{IANY} --- Bitwise OR of array elements
 @fnindex IANY
 @cindex array, OR
 @cindex bits, OR of array elements
@@ -5986,9 +6074,9 @@ PROGRAM test_iany
   INTEGER(1) :: a(2)
 
   a(1) = b'00100100'
-  a(1) = b'01101010'
+  a(2) = b'01101010'
 
-  ! prints 01111011
+  ! prints 01101110
   PRINT '(b8.8)', IANY(a)
 END PROGRAM
 @end smallexample
@@ -6667,9 +6755,9 @@ PROGRAM test_iparity
   INTEGER(1) :: a(2)
 
   a(1) = b'00100100'
-  a(1) = b'01101010'
+  a(2) = b'01101010'
 
-  ! prints 10111011
+  ! prints 01001110
   PRINT '(b8.8)', IPARITY(a)
 END PROGRAM
 @end smallexample
@@ -7228,7 +7316,8 @@ If all the bits of @code{I} are zero, the result value is @code{BIT_SIZE(I)}.
 @item @emph{Example}:
 @smallexample
 PROGRAM test_leadz
-  WRITE (*,*) LEADZ(1)  ! prints 8 if BITSIZE(I) has the value 32
+  WRITE (*,*) BIT_SIZE(1)  ! prints 32
+  WRITE (*,*) LEADZ(1)     ! prints 31
 END PROGRAM
 @end smallexample
 
@@ -8889,7 +8978,7 @@ end program
 Fortran 2003 and later
 
 @item @emph{Class}:
-Subroutine
+Pure subroutine
 
 @item @emph{Syntax}:
 @code{CALL MOVE_ALLOC(FROM, TO)}
@@ -12685,6 +12774,9 @@ Scalar default-integer constant used as STAT= return value by @code{UNLOCK} to
 denote that the lock variable is unlocked. (Fortran 2008 or later.)
 @end table
 
+The module also provides the following intrinsic procedures:
+@ref{COMPILER_OPTIONS} and @ref{COMPILER_VERSION}.
+
 
 
 @node ISO_C_BINDING
@@ -12704,6 +12796,7 @@ manual.
 @item @code{C_F_PROCPOINTER}
 @item @code{C_FUNLOC}
 @item @code{C_LOC}
+@item @code{C_SIZEOF}
 @end table
 @c TODO: Vertical spacing between C_FUNLOC and C_LOC wrong in PDF,
 @c don't really know why.