re PR fortran/37605 (Remarks on user manual for Gfortran)

2008-12-21  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.

Co-Authored-By: Daniel Kraft <d@domob.eu>

From-SVN: r142866
This commit is contained in:
Arjen Markus 2008-12-21 19:45:17 +01:00 committed by Daniel Kraft
parent b72bcb5225
commit aad9c4f437
4 changed files with 90 additions and 54 deletions

View File

@ -1,3 +1,12 @@
2008-12-21 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.
2008-12-18 Daniel Kraft <d@domob.eu> 2008-12-18 Daniel Kraft <d@domob.eu>
PR fortran/31822 PR fortran/31822

View File

@ -263,14 +263,13 @@ code designed to be efficiently translated and processed
by a machine such as your computer. by a machine such as your computer.
Humans usually aren't as good writing machine code Humans usually aren't as good writing machine code
as they are at writing Fortran (or C++, Ada, or Java), 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 @item
Provide the user with information about the reasons why Provide the user with information about the reasons why
the compiler is unable to create a binary from the source code. the compiler is unable to create a binary from the source code.
Usually this will be the case if the source code is flawed. 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 standard requires that the compiler can point out
The Fortran 90 requires that the compiler can point out
mistakes to the user. mistakes to the user.
An incorrect usage of the language causes an @dfn{error message}. An incorrect usage of the language causes an @dfn{error message}.
@ -986,8 +985,14 @@ equivalent to the standard-conforming declaration
TYPESPEC(k) x,y,z TYPESPEC(k) x,y,z
@end smallexample @end smallexample
@noindent @noindent
where @code{k} is equal to @code{size} for most types, but is equal to where @code{k} is the kind parameter suitable for the intended precision. As
@code{size/2} for the @code{COMPLEX} type. 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 @node Old-style variable initialization
@subsection Old-style variable initialization @subsection Old-style variable initialization
@ -1561,7 +1566,7 @@ worth a look.
The long history of the Fortran language, its wide use and broad The long history of the Fortran language, its wide use and broad
userbase, the large number of different compiler vendors and the lack of 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 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 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 aims at listing these extensions and offering advice on how best make
@ -1617,7 +1622,7 @@ store_catalog(7).id = 7831
store_catalog(7).description = "milk bottle" store_catalog(7).description = "milk bottle"
store_catalog(7).price = 1.2 store_catalog(7).price = 1.2
! We can also manipulates the whole structure ! We can also manipulate the whole structure
store_catalog(12) = pear store_catalog(12) = pear
print *, store_catalog(12) print *, store_catalog(12)
@end example @end example

View File

@ -318,8 +318,10 @@ the applicable standard for each intrinsic procedure is noted.
@table @asis @table @asis
@item @emph{Description}: @item @emph{Description}:
@code{ABORT} causes immediate termination of the program. On operating @code{ABORT} causes immediate termination of the program. On operating
systems that support a core dump, @code{ABORT} will produce a core dump, systems that support a core dump, @code{ABORT} will produce a core dump even if
which is suitable for debugging purposes. the option @option{-fno-dump-core} is in effect, which is suitable for debugging
purposes.
@c TODO: Check if this (with -fno-dump-core) is correct.
@item @emph{Standard}: @item @emph{Standard}:
GNU extension GNU extension
@ -540,7 +542,7 @@ Elemental function
@item @emph{Arguments}: @item @emph{Arguments}:
@multitable @columnfractions .15 .70 @multitable @columnfractions .15 .70
@item @var{X} @tab The type shall be @code{REAL} with a magnitude that is @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 @end multitable
@item @emph{Return value}: @item @emph{Return value}:
@ -632,7 +634,7 @@ Inverse function: @ref{COSH}
Spaces are inserted at the end of the string as needed. Spaces are inserted at the end of the string as needed.
@item @emph{Standard}: @item @emph{Standard}:
Fortran 95 and later Fortran 90 and later
@item @emph{Class}: @item @emph{Class}:
Elemental function Elemental function
@ -973,7 +975,7 @@ is @code{.TRUE.}; otherwise, it returns @code{.FALSE.}
program test_allocated program test_allocated
integer :: i = 4 integer :: i = 4
real(4), allocatable :: x(:) real(4), allocatable :: x(:)
if (allocated(x) .eqv. .false.) allocate(x(i)) if (.not. allocated(x)) allocate(x(i))
end program test_allocated end program test_allocated
@end smallexample @end smallexample
@end table @end table
@ -1179,7 +1181,7 @@ Elemental function
@item @emph{Arguments}: @item @emph{Arguments}:
@multitable @columnfractions .15 .70 @multitable @columnfractions .15 .70
@item @var{X} @tab The type shall be @code{REAL}, and a magnitude that is @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 @end multitable
@item @emph{Return value}: @item @emph{Return value}:
@ -1797,7 +1799,8 @@ end program test_besyn
@table @asis @table @asis
@item @emph{Description}: @item @emph{Description}:
@code{BIT_SIZE(I)} returns the number of bits (integer precision plus sign bit) @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}: @item @emph{Standard}:
Fortran 95 and later Fortran 95 and later
@ -1837,7 +1840,7 @@ end program test_bit_size
@table @asis @table @asis
@item @emph{Description}: @item @emph{Description}:
@code{BTEST(I,POS)} returns logical @code{.TRUE.} if the bit at @var{POS} @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}: @item @emph{Standard}:
Fortran 95 and later Fortran 95 and later
@ -2688,8 +2691,9 @@ Elemental function
@item @emph{Return value}: @item @emph{Return value}:
The return value is of type @code{REAL} and it is positive The return value is of type @code{REAL} and it is positive
(@math{ \cosh (x) \geq 0 }. The return value is of the same (@math{ \cosh (x) \geq 0 }). For a @code{REAL} argument @var{X},
kind as @var{X}. @math{ \cosh (x) \geq 1 }.
The return value is of the same kind as @var{X}.
@item @emph{Example}: @item @emph{Example}:
@smallexample @smallexample
@ -2724,7 +2728,7 @@ Inverse function: @ref{ACOSH}
@code{COUNT(MASK [, DIM [, KIND]])} counts the number of @code{.TRUE.} @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 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} @code{INTEGER} in the range of @math{1 /leq DIM /leq n)} where @math{n}
is the rank of @var{MASK}. is the rank of @var{MASK}.
@ -2844,7 +2848,7 @@ end program test_cpu_time
@item @emph{Description}: @item @emph{Description}:
@code{CSHIFT(ARRAY, SHIFT [, DIM])} performs a circular shift on elements of @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 @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}. 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 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 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 @node DIGITS
@section @code{DIGITS} --- Significant digits function @section @code{DIGITS} --- Significant binary digits function
@fnindex DIGITS @fnindex DIGITS
@cindex model representation, significant digits @cindex model representation, significant digits
@table @asis @table @asis
@item @emph{Description}: @item @emph{Description}:
@code{DIGITS(X)} returns the number of significant digits of the internal model @code{DIGITS(X)} returns the number of significant binary digits of the internal
representation of @var{X}. For example, on a system using a 32-bit 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. floating point representation, a default real number would likely return 24.
@item @emph{Standard}: @item @emph{Standard}:
@ -3282,7 +3286,7 @@ Transformational function
@end multitable @end multitable
@item @emph{Return value}: @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{INTEGER}, @code{REAL}, or @code{COMPLEX}. If the arguments are
@code{LOGICAL}, the return value is @code{.TRUE.} or @code{.FALSE.}. @code{LOGICAL}, the return value is @code{.TRUE.} or @code{.FALSE.}.
@ -3483,7 +3487,7 @@ end program test_dtime
@item @emph{Description}: @item @emph{Description}:
@code{EOSHIFT(ARRAY, SHIFT[, BOUNDARY, DIM])} performs an end-off shift on @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 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 @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 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, @var{ARRAY} are shifted by @var{SHIFT} places. If rank is greater than one,
@ -3511,7 +3515,7 @@ Transformational function
@item @emph{Arguments}: @item @emph{Arguments}:
@multitable @columnfractions .15 .70 @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{SHIFT} @tab The type shall be @code{INTEGER}.
@item @var{BOUNDARY} @tab Same type as @var{ARRAY}. @item @var{BOUNDARY} @tab Same type as @var{ARRAY}.
@item @var{DIM} @tab The type shall be @code{INTEGER}. @item @var{DIM} @tab The type shall be @code{INTEGER}.
@ -3546,7 +3550,8 @@ end program test_eoshift
@table @asis @table @asis
@item @emph{Description}: @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}.
@item @emph{Standard}: @item @emph{Standard}:
Fortran 95 and later Fortran 95 and later
@ -4875,11 +4880,12 @@ After @code{GET_COMMAND_ARGUMENT} returns, the @var{VALUE} argument holds the
@var{NUMBER}-th command line argument. If @var{VALUE} can not hold the argument, it is @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} 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. 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 If @math{@var{NUMBER} = 0}, @var{VALUE} is set to the name of the program (on
that support this feature). The @var{LENGTH} argument contains the length of the systems that support this feature). The @var{LENGTH} argument contains the
@var{NUMBER}-th command line argument. If the argument retrival fails, @var{STATUS} length of the @var{NUMBER}-th command line argument. If the argument retrieval
is a positiv number; if @var{VALUE} contains a truncated command line argument, fails, @var{STATUS} is a positive number; if @var{VALUE} contains a truncated
@var{STATUS} is -1; and otherwise the @var{STATUS} is zero. command line argument, @var{STATUS} is -1; and otherwise the @var{STATUS} is
zero.
@item @emph{Example}: @item @emph{Example}:
@smallexample @smallexample
@ -5722,7 +5728,7 @@ the kind shall be the default integer kind.
@end multitable @end multitable
@item @emph{Return value}: @item @emph{Return value}:
Does not return. Does not return anything.
@item @emph{Example}: @item @emph{Example}:
@smallexample @smallexample
@ -6368,7 +6374,7 @@ and the kind shall be the default integer kind.
@end multitable @end multitable
@item @emph{Return value}: @item @emph{Return value}:
Does not return. Does not return anything.
@item @emph{Example}: @item @emph{Example}:
@ -6957,6 +6963,8 @@ Elemental function
@item @emph{Return value}: @item @emph{Return value}:
The return value is of type @code{REAL} or @code{COMPLEX}. The return value is of type @code{REAL} or @code{COMPLEX}.
The kind type parameter is the same as @var{X}. 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}: @item @emph{Example}:
@smallexample @smallexample
@ -7563,9 +7571,9 @@ the @var{DIM} argument is supplied, determines the maximum value along
each row of the array in the @var{DIM} direction. If @var{MASK} is 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 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 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 @var{MASK} are @code{.FALSE.}, then the result is @code{-HUGE(ARRAY)}
number of the type and kind of @var{ARRAY} if @var{ARRAY} is numeric, or if @var{ARRAY} is numeric, or a string of nulls if @var{ARRAY} is of character
a string of nulls if @var{ARRAY} is of character type. type.
@item @emph{Standard}: @item @emph{Standard}:
Fortran 95 and later Fortran 95 and later
@ -9472,8 +9480,8 @@ end program large_integers
@table @asis @table @asis
@item @emph{Description}: @item @emph{Description}:
@code{SELECTED_REAL_KIND(P,R)} return the kind value of a real data type @code{SELECTED_REAL_KIND(P,R)} returns the kind value of a real data type
with decimal precision greater of at least @code{P} digits and exponent with decimal precision of at least @code{P} digits and exponent
range greater at least @code{R}. range greater at least @code{R}.
@item @emph{Standard}: @item @emph{Standard}:
@ -9709,6 +9717,7 @@ Subroutine, function
@item @var{STATUS} @tab (Optional) @var{STATUS} shall be a scalar @item @var{STATUS} @tab (Optional) @var{STATUS} shall be a scalar
integer. It has @code{INTENT(OUT)}. integer. It has @code{INTENT(OUT)}.
@end multitable @end multitable
@c TODO: What should the interface of the handler be? Does it take arguments?
@item @emph{Return value}: @item @emph{Return value}:
The @code{SIGNAL} function returns the value returned by @code{signal(2)}. The @code{SIGNAL} function returns the value returned by @code{signal(2)}.
@ -10173,7 +10182,7 @@ Subroutine
@end multitable @end multitable
@item @emph{Return value}: @item @emph{Return value}:
Does not return. Does not return anything.
@item @emph{Example}: @item @emph{Example}:
See @code{RAND} and @code{IRAND} for examples. See @code{RAND} and @code{IRAND} for examples.
@ -11242,6 +11251,8 @@ manual.
@item @code{C_FUNLOC} @item @code{C_FUNLOC}
@item @code{C_LOC} @item @code{C_LOC}
@end table @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 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 type integer, which can be used as KIND type parameter. Note that GNU
@ -11290,7 +11301,7 @@ C_INT_LEAST128_T, C_INT_FAST128_T}.
@item @code{CHARACTER}@tab @code{C_CHAR} @tab @code{char} @item @code{CHARACTER}@tab @code{C_CHAR} @tab @code{char}
@end multitable @end multitable
Additionally, the following @code{(CHARACTER(KIND=C_CHAR)} are Additionally, the following @code{(CHARACTER(KIND=C_CHAR))} are
defined. defined.
@multitable @columnfractions .20 .45 .15 @multitable @columnfractions .20 .45 .15

View File

@ -210,12 +210,12 @@ form is determined by the file extension.
@item -fall-intrinsics @item -fall-intrinsics
@opindex @code{fall-intrinsics} @opindex @code{fall-intrinsics}
Accept all of the intrinsic procedures provided in libgfortran This option causes all intrinsic procedures (including the GNU-specific
without regard to the setting of @option{-std}. In particular, extensions) to be accepted. This can be useful with @option{-std=f95} to
this option can be quite useful with @option{-std=f95}. Additionally, force standard-compliance but get access to the full range of intrinsics
@command{gfortran} will ignore @option{-Wintrinsics-std} and will never try available with @command{gfortran}. As a consequence, @option{-Wintrinsics-std}
to link to an @code{EXTERNAL} version if the intrinsic is not included in the will be ignored and no user-defined procedure with the same name as any
selected standard. intrinsic will be called except when it is explicitly declared @code{EXTERNAL}.
@item -fd-lines-as-code @item -fd-lines-as-code
@item -fd-lines-as-comments @item -fd-lines-as-comments
@ -229,17 +229,26 @@ comment lines.
@item -fdefault-double-8 @item -fdefault-double-8
@opindex @code{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 @item -fdefault-integer-8
@opindex @code{fdefault-integer-8} @opindex @code{fdefault-integer-8}
Set the default integer and logical types to an 8 byte wide type. 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 @item -fdefault-real-8
@opindex @code{fdefault-real-8} @opindex @code{fdefault-real-8}
Set the default real type to an 8 byte wide type. 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 @item -fdollar-ok
@opindex @code{fdollar-ok} @opindex @code{fdollar-ok}
@ -861,7 +870,7 @@ zero), @samp{overflow} (overflow in a floating point operation),
(operation produced a denormal value). (operation produced a denormal value).
Some of the routines in the Fortran runtime library, like 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 used. For this reason, the use of
@code{ffpe-trap=precision} is not recommended. @code{ffpe-trap=precision} is not recommended.
@ -1183,13 +1192,15 @@ by use of the @option{-ff2c} option.
Enable generation of run-time checks for array subscripts Enable generation of run-time checks for array subscripts
and against the declared minimum and maximum values. It also and against the declared minimum and maximum values. It also
checks array indices for assumed and deferred 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 Some checks require that @option{-fbounds-check} is set for
the compilation of the main program. the compilation of the main program.
In the future this may also include other forms of checking, e.g., checking Note: In the future this may also include other forms of checking, e.g.,
substring references. checking substring references.
@item fcheck-array-temporaries @item fcheck-array-temporaries