This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch, Fortran, Doc] Some gfortran manual improvements


Hi all,

following on the recent fortran-list-post, here's a revised patch regarding Arjen's comments on the Fortran manual.

I tried to address the comments on the list as much as possible, but there are still three XXX comments in there I'd like to get specific answers and comments on if possible (and will remove them before committing).

The documentation of supported KIND identifiers as suggested by Tobias will be a seperate patch following this one, because I'd like to concentrate on the "small fixes" character here.

What do you think, ok for committing? make info/pdf/html works fine for me.

Yours,
Daniel

--
Done:  Arc-Bar-Cav-Rog-Sam-Tou-Val-Wiz
To go: Hea-Kni-Mon-Pri-Ran
Index: gcc/fortran/gfortran.texi
===================================================================
--- gcc/fortran/gfortran.texi	(revision 142538)
+++ gcc/fortran/gfortran.texi	(working copy)
@@ -263,14 +263,13 @@ code designed to be efficiently translat
 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}.
 
@@ -986,8 +985,14 @@ equivalent to the standard-conforming de
       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
 @subsection Old-style variable initialization
@@ -1561,9 +1566,9 @@ worth a look.
 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 an important number of extensions to the language. While
+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
+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.
 
@@ -1617,7 +1622,7 @@ store_catalog(7).id = 7831
 store_catalog(7).description = "milk bottle"
 store_catalog(7).price = 1.2
 
-! We can also manipulates the whole structure
+! We can also manipulate the whole structure
 store_catalog(12) = pear
 print *, store_catalog(12)
 @end example
Index: gcc/fortran/invoke.texi
===================================================================
--- gcc/fortran/invoke.texi	(revision 142538)
+++ gcc/fortran/invoke.texi	(working copy)
@@ -210,12 +210,12 @@ form is determined by the file extension
 
 @item -fall-intrinsics
 @opindex @code{fall-intrinsics}
-Accept all of the intrinsic procedures provided in libgfortran 
-without regard to the setting of @option{-std}.  In particular, 
-this option can be quite useful with @option{-std=f95}.  Additionally,
-@command{gfortran} will ignore @option{-Wintrinsics-std} and will never try
-to link to an @code{EXTERNAL} version if the intrinsic is not included in the
-selected standard.
+This option causes all intrinsic procedures (including the GNU-specific
+extensions) to be accepted.  This can be useful with @option{-std=f95} to
+force standard-compliance but get access to the full range of intrinsics
+available with @command{gfortran}.  As a consequence, @option{-Wintrinsics-std}
+will be ignored and no user-defined procedure with the same name as any
+intrinsic will be called except when it is explicitly declared @code{EXTERNAL}.
 
 @item -fd-lines-as-code
 @item -fd-lines-as-comments
@@ -229,17 +229,26 @@ comment lines.
 
 @item -fdefault-double-8
 @opindex @code{fdefault-double-8}
-Set the @code{DOUBLE PRECISION} type to an 8 byte wide type.
+Set the @code{DOUBLE PRECISION} type to an 8 byte wide type.  If
+@option{-fdefault-real-8} is given, @code{DOUBLE PRECISION} would
+instead be promoted to 16 bytes if possible, and @option{-fdefault-double-8}
+can be used to prevent this.  The kind of real constants like @code{1.d0} will
+not be changed by @option{-fdefault-real-8} though, so also
+@option{-fdefault-double-8} does not affect it.
 
 @item -fdefault-integer-8
 @opindex @code{fdefault-integer-8}
 Set the default integer and logical types to an 8 byte wide type.
-Do nothing if this is already the default.
+Do nothing if this is already the default.  This option also affects
+the kind of integer constants like @code{42}.
 
 @item -fdefault-real-8
 @opindex @code{fdefault-real-8}
 Set the default real type to an 8 byte wide type.
-Do nothing if this is already the default.
+Do nothing if this is already the default.  This option also affects
+the kind of non-double real constants like @code{1.0}, and does promote
+the default width of @code{DOUBLE PRECISION} to 16 bytes if possible, unless
+@code{-fdefault-double-8} is given, too.
 
 @item -fdollar-ok
 @opindex @code{fdollar-ok}
@@ -852,7 +861,7 @@ zero), @samp{overflow} (overflow in a fl
 (operation produced a denormal value).
 
 Some of the routines in the Fortran runtime library, like
-@samp{CPU_TIME}, are likely to to trigger floating point exceptions when
+@samp{CPU_TIME}, are likely to trigger floating point exceptions when
 @code{ffpe-trap=precision} is used. For this reason, the use of 
 @code{ffpe-trap=precision} is not recommended.
 
@@ -1174,13 +1183,15 @@ by use of the @option{-ff2c} option.
 Enable generation of run-time checks for array subscripts
 and against the declared minimum and maximum values.  It also
 checks array indices for assumed and deferred
-shape arrays against the actual allocated bounds.
+shape arrays against the actual allocated bounds and ensures that all string
+lengths are equal for character array constructors without an explicit
+typespec.
 
 Some checks require that @option{-fbounds-check} is set for
 the compilation of the main program.
 
-In the future this may also include other forms of checking, e.g., checking
-substring references.
+Note: In the future this may also include other forms of checking, e.g.,
+checking substring references.
 
 
 @item fcheck-array-temporaries
Index: gcc/fortran/intrinsic.texi
===================================================================
--- gcc/fortran/intrinsic.texi	(revision 142538)
+++ gcc/fortran/intrinsic.texi	(working copy)
@@ -318,8 +318,10 @@ the applicable standard for each intrins
 @table @asis
 @item @emph{Description}:
 @code{ABORT} causes immediate termination of the program.  On operating
-systems that support a core dump, @code{ABORT} will produce a core dump,
-which is suitable for debugging purposes.
+systems that support a core dump, @code{ABORT} will produce a core dump even if
+the option @option{-fno-dump-core} is in effect, which is suitable for debugging
+purposes.
+@c XXX: Is this (with -fno-dump-core) correct?
 
 @item @emph{Standard}:
 GNU extension
@@ -540,7 +542,7 @@ Elemental function
 @item @emph{Arguments}:
 @multitable @columnfractions .15 .70
 @item @var{X} @tab The type shall be @code{REAL} with a magnitude that is
-less than one.
+less than or equal to one.
 @end multitable
 
 @item @emph{Return value}:
@@ -632,7 +634,7 @@ Inverse function: @ref{COSH}
 Spaces are inserted at the end of the string as needed.
 
 @item @emph{Standard}:
-Fortran 95 and later
+Fortran 90 and later
 
 @item @emph{Class}:
 Elemental function
@@ -973,7 +975,7 @@ is @code{.TRUE.}; otherwise, it returns 
 program test_allocated
   integer :: i = 4
   real(4), allocatable :: x(:)
-  if (allocated(x) .eqv. .false.) allocate(x(i))
+  if (.not. allocated(x)) allocate(x(i))
 end program test_allocated
 @end smallexample
 @end table
@@ -1179,7 +1181,7 @@ Elemental function
 @item @emph{Arguments}:
 @multitable @columnfractions .15 .70
 @item @var{X} @tab The type shall be @code{REAL}, and a magnitude that is
-less than one.
+less than or equal to one.
 @end multitable
 
 @item @emph{Return value}:
@@ -1797,7 +1799,8 @@ end program test_besyn
 @table @asis
 @item @emph{Description}:
 @code{BIT_SIZE(I)} returns the number of bits (integer precision plus sign bit)
-represented by the type of @var{I}.
+represented by the type of @var{I}.  The result of @code{BIT_SIZE(I)} is
+independent of the actual value of @var{I}.
 
 @item @emph{Standard}:
 Fortran 95 and later
@@ -1837,7 +1840,7 @@ end program test_bit_size
 @table @asis
 @item @emph{Description}:
 @code{BTEST(I,POS)} returns logical @code{.TRUE.} if the bit at @var{POS}
-in @var{I} is set.
+in @var{I} is set.  The counting of the bits starts at 0.
 
 @item @emph{Standard}:
 Fortran 95 and later
@@ -2688,8 +2691,9 @@ Elemental function
 
 @item @emph{Return value}:
 The return value is of type @code{REAL} and it is positive
-(@math{ \cosh (x) \geq 0 }. The return value is of the same
-kind as @var{X}.
+(@math{ \cosh (x) \geq 0 }).  For a @code{REAL} argument @var{X},
+@math{ \cosh (x) \geq 1 }.
+The return value is of the same kind as @var{X}.
 
 @item @emph{Example}:
 @smallexample
@@ -2724,7 +2728,7 @@ Inverse function: @ref{ACOSH}
 
 @code{COUNT(MASK [, DIM [, KIND]])} counts the number of @code{.TRUE.}
 elements of @var{MASK} along the dimension of @var{DIM}.  If @var{DIM} is
-omitted it is taken to be @code{1}.  @var{DIM} is a scaler of type
+omitted it is taken to be @code{1}.  @var{DIM} is a scalar of type
 @code{INTEGER} in the range of @math{1 /leq DIM /leq n)} where @math{n}
 is the rank of @var{MASK}.
 
@@ -2844,7 +2848,7 @@ end program test_cpu_time
 @item @emph{Description}:
 @code{CSHIFT(ARRAY, SHIFT [, DIM])} performs a circular shift on elements of
 @var{ARRAY} along the dimension of @var{DIM}.  If @var{DIM} is omitted it is
-taken to be @code{1}.  @var{DIM} is a scaler of type @code{INTEGER} in the
+taken to be @code{1}.  @var{DIM} is a scalar of type @code{INTEGER} in the
 range of @math{1 /leq DIM /leq n)} where @math{n} is the rank of @var{ARRAY}.
 If the rank of @var{ARRAY} is one, then all elements of @var{ARRAY} are shifted
 by @var{SHIFT} places.  If rank is greater than one, then all complete rank one
@@ -3155,14 +3159,14 @@ end program test_dfloat
 
 
 @node DIGITS
-@section @code{DIGITS} --- Significant digits function
+@section @code{DIGITS} --- Significant binary digits function
 @fnindex DIGITS
 @cindex model representation, significant digits
 
 @table @asis
 @item @emph{Description}:
-@code{DIGITS(X)} returns the number of significant digits of the internal model
-representation of @var{X}.  For example, on a system using a 32-bit
+@code{DIGITS(X)} returns the number of significant binary digits of the internal
+model representation of @var{X}.  For example, on a system using a 32-bit
 floating point representation, a default real number would likely return 24.
 
 @item @emph{Standard}:
@@ -3282,7 +3286,7 @@ Transformational function
 @end multitable
 
 @item @emph{Return value}:
-If the arguments are numeric, the return value is a scaler of numeric type,
+If the arguments are numeric, the return value is a scalar of numeric type,
 @code{INTEGER}, @code{REAL}, or @code{COMPLEX}.  If the arguments are
 @code{LOGICAL}, the return value is @code{.TRUE.} or @code{.FALSE.}.
 
@@ -3483,7 +3487,7 @@ end program test_dtime
 @item @emph{Description}:
 @code{EOSHIFT(ARRAY, SHIFT[, BOUNDARY, DIM])} performs an end-off shift on
 elements of @var{ARRAY} along the dimension of @var{DIM}.  If @var{DIM} is
-omitted it is taken to be @code{1}.  @var{DIM} is a scaler of type
+omitted it is taken to be @code{1}.  @var{DIM} is a scalar of type
 @code{INTEGER} in the range of @math{1 /leq DIM /leq n)} where @math{n} is the
 rank of @var{ARRAY}.  If the rank of @var{ARRAY} is one, then all elements of
 @var{ARRAY} are shifted by @var{SHIFT} places.  If rank is greater than one,
@@ -3511,7 +3515,7 @@ Transformational function
 
 @item @emph{Arguments}:
 @multitable @columnfractions .15 .70
-@item @var{ARRAY}  @tab May be any type, not scaler.
+@item @var{ARRAY}  @tab May be any type, not scalar.
 @item @var{SHIFT}  @tab The type shall be @code{INTEGER}.
 @item @var{BOUNDARY} @tab Same type as @var{ARRAY}. 
 @item @var{DIM}    @tab The type shall be @code{INTEGER}.
@@ -3546,7 +3550,10 @@ end program test_eoshift
 
 @table @asis
 @item @emph{Description}:
-@code{EPSILON(X)} returns a nearly negligible number relative to @code{1}.
+@code{EPSILON(X)} returns the smallest number @var{E} of the same kind
+as @var{X} such that @math{1 + E > 1}.
+@c XXX: Changed description of EPSILON to make it better understandable (?),
+@c but the original version was the one in the standard.  Ok or revert?
 
 @item @emph{Standard}:
 Fortran 95 and later
@@ -4875,11 +4882,12 @@ After @code{GET_COMMAND_ARGUMENT} return
 @var{NUMBER}-th command line argument. If @var{VALUE} can not hold the argument, it is 
 truncated to fit the length of @var{VALUE}. If there are less than @var{NUMBER}
 arguments specified at the command line, @var{VALUE} will be filled with blanks. 
-If @math{@var{NUMBER} = 0}, @var{VALUE} is set to the name of the program (on systems
-that support this feature). The @var{LENGTH} argument contains the length of the
-@var{NUMBER}-th command line argument. If the argument retrival fails, @var{STATUS}
-is a positiv number; if @var{VALUE} contains a truncated command line argument,
-@var{STATUS} is -1; and otherwise the @var{STATUS} is zero.
+If @math{@var{NUMBER} = 0}, @var{VALUE} is set to the name of the program (on
+systems that support this feature). The @var{LENGTH} argument contains the
+length of the @var{NUMBER}-th command line argument. If the argument retrieval
+fails, @var{STATUS} is a positive number; if @var{VALUE} contains a truncated
+command line argument, @var{STATUS} is -1; and otherwise the @var{STATUS} is
+zero.
 
 @item @emph{Example}:
 @smallexample
@@ -5722,7 +5730,7 @@ the kind shall be the default integer ki
 @end multitable
 
 @item @emph{Return value}:
-Does not return.
+Does not return anything.
 
 @item @emph{Example}:
 @smallexample
@@ -6368,7 +6376,7 @@ and the kind shall be the default intege
 @end multitable
 
 @item @emph{Return value}:
-Does not return.
+Does not return anything.
 
 
 @item @emph{Example}:
@@ -6957,6 +6965,8 @@ Elemental function
 @item @emph{Return value}:
 The return value is of type @code{REAL} or @code{COMPLEX}.
 The kind type parameter is the same as @var{X}.
+If @var{X} is @code{COMPLEX}, the imaginary part @math{\omega} is in the range
+@math{-\pi \leq \omega \leq \pi}.
 
 @item @emph{Example}:
 @smallexample
@@ -7563,9 +7573,9 @@ the @var{DIM} argument is supplied, dete
 each row of the array in the @var{DIM} direction.  If @var{MASK} is
 present, only the elements for which @var{MASK} is @code{.TRUE.} are
 considered.  If the array has zero size, or all of the elements of
-@var{MASK} are @code{.FALSE.}, then the result is the most negative
-number of the type and kind of @var{ARRAY} if @var{ARRAY} is numeric, or
-a string of nulls if @var{ARRAY} is of character type.
+@var{MASK} are @code{.FALSE.}, then the result is @code{-HUGE(ARRAY)}
+if @var{ARRAY} is numeric, or a string of nulls if @var{ARRAY} is of character
+type.
 
 @item @emph{Standard}:
 Fortran 95 and later
@@ -9472,8 +9482,8 @@ end program large_integers
 
 @table @asis
 @item @emph{Description}:
-@code{SELECTED_REAL_KIND(P,R)} return the kind value of a real data type
-with decimal precision greater of at least @code{P} digits and exponent
+@code{SELECTED_REAL_KIND(P,R)} returns the kind value of a real data type
+with decimal precision of at least @code{P} digits and exponent
 range greater at least @code{R}. 
 
 @item @emph{Standard}:
@@ -9709,6 +9719,7 @@ Subroutine, function
 @item @var{STATUS} @tab (Optional) @var{STATUS} shall be a scalar
 integer. It has @code{INTENT(OUT)}.
 @end multitable
+@c XXX: What should the interface of the handler be?  Does it take arguments?
 
 @item @emph{Return value}:
 The @code{SIGNAL} function returns the value returned by @code{signal(2)}.
@@ -10173,7 +10184,7 @@ Subroutine
 @end multitable
 
 @item @emph{Return value}:
-Does not return.
+Does not return anything.
 
 @item @emph{Example}:
 See @code{RAND} and @code{IRAND} for examples.
@@ -11242,6 +11253,8 @@ manual.
 @item @code{C_FUNLOC}
 @item @code{C_LOC}
 @end table
+@c TODO: Vertical spacing between C_FUNLOC and C_LOC wrong in PDF,
+@c don't really know why.
 
 The @code{ISO_C_BINDING} module provides the following named constants of the
 type integer, which can be used as KIND type parameter. Note that GNU
@@ -11290,7 +11303,7 @@ C_INT_LEAST128_T, C_INT_FAST128_T}.
 @item @code{CHARACTER}@tab @code{C_CHAR}        @tab @code{char}
 @end multitable
 
-Additionally, the following @code{(CHARACTER(KIND=C_CHAR)} are
+Additionally, the following @code{(CHARACTER(KIND=C_CHAR))} are
 defined.
 
 @multitable @columnfractions .20 .45 .15
2008-12-12  Arjen Markus  <arjen.markus@wldelft.nl>
	    Daniel Kraft  <d@domob.eu>

	PR fortran/37605
	* gfortran.texi: Fixed some typos and some minor style improvements.
	* intrinsic.texi: Some clarifications and typo-fixes.
	* invoke.texi: Better documenation of the behaviour of the
	-fdefault-*-8 options and some other fixes.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]