aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Burnus <burnus@gcc.gnu.org>2009-12-08 09:52:28 +0100
committerTobias Burnus <burnus@gcc.gnu.org>2009-12-08 09:52:28 +0100
commit96c493240211f9103b0a19d0411b2e8e4d0da11c (patch)
tree7a267c95812e3724441abed4c6e18961257d544d
parent698861dc8d0d800c0eae3c704cbc86cbf2649a58 (diff)
downloadgcc-96c493240211f9103b0a19d0411b2e8e4d0da11c.zip
gcc-96c493240211f9103b0a19d0411b2e8e4d0da11c.tar.gz
gcc-96c493240211f9103b0a19d0411b2e8e4d0da11c.tar.bz2
re PR fortran/40961 (Document set_fpe(int))
2009-12-08 Tobias Burnus <burnus@net-b.de> PR fortran/40961 PR fortran/40377 * gfortran.texi (Non-Fortran Main Program): Add _gfortran_set_fpe documentation. (Interoperability with C): Mention array storage order. From-SVN: r155083
-rw-r--r--gcc/fortran/ChangeLog14
-rw-r--r--gcc/fortran/gfortran.texi47
2 files changed, 57 insertions, 4 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 49f6b8f..24db229 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,8 +1,16 @@
+2009-12-08 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/40961
+ PR fortran/40377
+ * gfortran.texi (Non-Fortran Main Program): Add
+ _gfortran_set_fpe documentation.
+ (Interoperability with C): Mention array storage order.
+
2009-12-07 Daniel Franke <franke.daniel@gmail.com>
- PR fortran/41940
- * match.c (gfc_match_allocate): Improved error message for
- allocatable scalars that are allocated with a shape.
+ PR fortran/41940
+ * match.c (gfc_match_allocate): Improved error message for
+ allocatable scalars that are allocated with a shape.
2009-12-07 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
diff --git a/gcc/fortran/gfortran.texi b/gcc/fortran/gfortran.texi
index 1430c8a..e9adb3d 100644
--- a/gcc/fortran/gfortran.texi
+++ b/gcc/fortran/gfortran.texi
@@ -1911,6 +1911,12 @@ 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.
+Note that array dimensions are reversely orded in C and that arrays in
+C always start with index 0 while in Fortran they start by default with
+1. Thus, an array declaration @code{A(n,m)} in Fortran matches
+@code{A[m][n]} in C and accessing the element @code{A(i,j)} matches
+@code{A[j-1][i-1]}. The element following @code{A(i,j)} (C: @code{A[j-1][i-1]};
+assuming @math{i < n}) in memory is @code{A(i+1,j)} (C: @code{A[j-1][i]}).
@node Intrinsic Types
@subsection Intrinsic Types
@@ -2191,6 +2197,7 @@ the same declaration part as the variable or procedure pointer.
* _gfortran_set_convert:: Set endian conversion
* _gfortran_set_record_marker:: Set length of record markers
* _gfortran_set_max_subrecord_length:: Set subrecord length
+* _gfortran_set_fpe:: Set when a Floating Point Exception should be raised
@end menu
Even if you are doing mixed-language programming, it is very
@@ -2362,7 +2369,7 @@ int main (int argc, char *argv[])
@table @asis
@item @emph{Description}:
-@code{_gfortran_set_record_marker} set the length of record markers
+@code{_gfortran_set_record_marker} sets the length of record markers
for unformatted files.
@item @emph{Syntax}:
@@ -2387,6 +2394,44 @@ int main (int argc, char *argv[])
@end table
+@node _gfortran_set_fpe
+@subsection @code{_gfortran_set_fpe} --- Set when a Floating Point Exception should be raised
+@fnindex _gfortran_set_fpe
+@cindex libgfortran initialization, set_fpe
+
+@table @asis
+@item @emph{Description}:
+@code{_gfortran_set_fpe} sets the IEEE exceptions for which a
+Floating Point Exception (FPE) should be raised. On most systems,
+this will result in a SIGFPE signal being sent and the program
+being interrupted.
+
+@item @emph{Syntax}:
+@code{void _gfortran_set_fpe (int val)}
+
+@item @emph{Arguments}:
+@multitable @columnfractions .15 .70
+@item @var{option}[0] @tab IEEE exceptions. Possible values are
+(bitwise or-ed) zero (0, default) no trapping,
+@code{GFC_FPE_INVALID} (1), @code{GFC_FPE_DENORMAL} (2),
+@code{GFC_FPE_ZERO} (4), @code{GFC_FPE_OVERFLOW} (8),
+@code{GFC_FPE_UNDERFLOW} (16), and @code{GFC_FPE_PRECISION} (32).
+@end multitable
+
+@item @emph{Example}:
+@smallexample
+int main (int argc, char *argv[])
+@{
+ /* Initialize libgfortran. */
+ _gfortran_set_args (argc, argv);
+ /* FPE for invalid operations such as SQRT(-1.0). */
+ _gfortran_set_fpe (1);
+ 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