From 8b198102220210ef6a61477d9a45564c206ee6b5 Mon Sep 17 00:00:00 2001 From: Francois-Xavier Coudert Date: Sat, 28 Jun 2014 14:17:41 +0000 Subject: re PR fortran/29383 (Fortran 2003/F95[TR15580:1999]: Floating point exception (IEEE) support) PR fortran/29383 gcc/fortran/ * gfortran.h (gfc_simplify_ieee_selected_real_kind): New prototype. * libgfortran.h (GFC_FPE_*): Use simple integer values, valid in both C and Fortran. * expr.c (gfc_check_init_expr): Simplify IEEE_SELECTED_REAL_KIND. * simplify.c (gfc_simplify_ieee_selected_real_kind): New function. * module.c (mio_symbol): Keep track of symbols which came from intrinsic modules. (gfc_use_module): Keep track of the IEEE modules. * trans-decl.c (gfc_get_symbol_decl): Adjust code since we have new intrinsic modules. (gfc_build_builtin_function_decls): Build decls for ieee_procedure_entry and ieee_procedure_exit. (is_from_ieee_module, is_ieee_module_used, save_fp_state, restore_fp_state): New functions. (gfc_generate_function_code): Save and restore floating-point state on procedure entry/exit, when IEEE modules are used. * intrinsic.texi: Document the IEEE modules. libgfortran/ * configure.host: Add checks for IEEE support, rework priorities. * configure.ac: Define IEEE_SUPPORT, check for fpsetsticky and fpresetsticky. * configure: Regenerate. * Makefile.am: Build new ieee files, install IEEE_* modules. * Makefile.in: Regenerate. * gfortran.map (GFORTRAN_1.6): Add new symbols. * libgfortran.h (get_fpu_trap_exceptions, set_fpu_trap_exceptions, support_fpu_trap, set_fpu_except_flags, support_fpu_flag, support_fpu_rounding_mode, get_fpu_state, set_fpu_state): New prototypes. * config/fpu-*.h (get_fpu_trap_exceptions, set_fpu_trap_exceptions, support_fpu_trap, set_fpu_except_flags, support_fpu_flag, support_fpu_rounding_mode, get_fpu_state, set_fpu_state): New functions. * ieee/ieee_features.F90: New file. * ieee/ieee_exceptions.F90: New file. * ieee/ieee_arithmetic.F90: New file. * ieee/ieee_helper.c: New file. gcc/testsuite/ * lib/target-supports.exp (check_effective_target_fortran_ieee): New function. * gfortran.dg/ieee/ieee.exp: New file. * gfortran.dg/ieee/ieee_1.F90: New file. * gfortran.dg/ieee/ieee_2.f90: New file. * gfortran.dg/ieee/ieee_3.f90: New file. * gfortran.dg/ieee/ieee_4.f90: New file. * gfortran.dg/ieee/ieee_5.f90: New file. * gfortran.dg/ieee/ieee_6.f90: New file. * gfortran.dg/ieee/ieee_7.f90: New file. * gfortran.dg/ieee/ieee_rounding_1.f90: New file. From-SVN: r212102 --- gcc/fortran/intrinsic.texi | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'gcc/fortran/intrinsic.texi') diff --git a/gcc/fortran/intrinsic.texi b/gcc/fortran/intrinsic.texi index 202063f..87f6478 100644 --- a/gcc/fortran/intrinsic.texi +++ b/gcc/fortran/intrinsic.texi @@ -13155,6 +13155,7 @@ Fortran 95 elemental function: @ref{IEOR} @menu * ISO_FORTRAN_ENV:: * ISO_C_BINDING:: +* IEEE modules:: * OpenMP Modules OMP_LIB and OMP_LIB_KINDS:: @end menu @@ -13366,6 +13367,35 @@ Moreover, the following two named constants are defined: Both are equivalent to the value @code{NULL} in C. + + +@node IEEE modules +@section IEEE modules: @code{IEEE_EXCEPTIONS}, @code{IEEE_ARITHMETIC}, and @code{IEEE_FEATURES} +@table @asis +@item @emph{Standard}: +Fortran 2003 and later +@end table + +The @code{IEEE_EXCEPTIONS}, @code{IEEE_ARITHMETIC}, and @code{IEEE_FEATURES} +intrinsic modules provide support for exceptions and IEEE arithmetic, as +defined in Fortran 2003 and later standards, and the IEC 60559:1989 standard +(@emph{Binary floating-point arithmetic for microprocessor systems}). These +modules are only provided on the following supported platforms: + +@itemize @bullet +@item i386 and x86_64 processors +@item platforms which use the GNU C Library (glibc) +@item platforms with support for SysV/386 routines for floating point +interface (including Solaris and BSDs) +@item platforms with the AIX OS +@end itemize + +For full compliance with the Fortran standards, code using the +@code{IEEE_EXCEPTIONS} or @code{IEEE_ARITHMETIC} modules should be compiled +with the following options: @code{-fno-unsafe-math-optimizations +-frounding-math -fsignaling-nans}. + + @node OpenMP Modules OMP_LIB and OMP_LIB_KINDS @section OpenMP Modules @code{OMP_LIB} and @code{OMP_LIB_KINDS} @table @asis -- cgit v1.1