This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [Patch, Fortran] Print floating-point exception status after STOP/ERROR STOP
- From: Tobias Burnus <burnus at net-b dot de>
- To: Eric Botcazou <ebotcazou at adacore dot com>
- Cc: Gerald Pfeifer <gerald at pfeifer dot com>, gcc-patches at gcc dot gnu dot org, fortran at gcc dot gnu dot org, David Edelsohn <dje dot gcc at gmail dot com>, Uros Bizjak <ubizjak at gmail dot com>
- Date: Mon, 24 Jun 2013 10:38:49 +0200
- Subject: Re: [Patch, Fortran] Print floating-point exception status after STOP/ERROR STOP
- References: <51B8721A dot 6000000 at net-b dot de> <2737126 dot 5b1v7aemIl at polaris> <alpine dot LNX dot 2 dot 00 dot 1306222057160 dot 2896 at trevally dot site> <2494409 dot 3FinfxvR0z at polaris> <51C6256E dot 1020708 at net-b dot de>
Eric, Gerald, all,
I have now committed (Rev. 200360) the attached patch. (Compared to the
draft patch, with a missing "," added in AC_CHECK_TYPES).
Eric, Gerald: Can you confirm that it now works on both FreeBSD and Solaris?
Eric: Should one (conditionally) include <floatingpoint.h> on Solaris? I
am asking because LIBGFOR_CHECK_FPSETMASK in acinclude.m4 uses that
include file during configure - but libgfortran.h (or config/fpu-sysv.h)
don't.
Tobias
Index: libgfortran/ChangeLog
===================================================================
--- libgfortran/ChangeLog (Revision 200359)
+++ libgfortran/ChangeLog (Arbeitskopie)
@@ -1,3 +1,10 @@
+2013-06-24 Tobias Burnus <burnus@net-b.de>
+
+ * configure.ac: Check for fp_except and fp_except_t.
+ * config/fpu-sysv.h: Conditionally use either type.
+ * configure: Regenerate.
+ * config.h.in: Regenerate.
+
2013-06-21 Eric Botcazou <ebotcazou@adacore.com>
* config/fpu-sysv.h (get_fpu_except_flags): Fix typo.
Index: libgfortran/config/fpu-sysv.h
===================================================================
--- libgfortran/config/fpu-sysv.h (Revision 200359)
+++ libgfortran/config/fpu-sysv.h (Arbeitskopie)
@@ -85,7 +85,13 @@ int
get_fpu_except_flags (void)
{
int result;
+#if HAVE_FP_EXCEPT
fp_except set_excepts;
+#elif HAVE_FP_EXCEPT_T
+ fp_except_t set_excepts;
+#else
+ choke me
+#endif
result = 0;
set_excepts = fpgetsticky ();
Index: libgfortran/config.h.in
===================================================================
--- libgfortran/config.h.in (Revision 200359)
+++ libgfortran/config.h.in (Arbeitskopie)
@@ -405,6 +405,12 @@
/* fp_enable is present */
#undef HAVE_FP_ENABLE
+/* Define to 1 if the system has the type `fp_except'. */
+#undef HAVE_FP_EXCEPT
+
+/* Define to 1 if the system has the type `fp_except_t'. */
+#undef HAVE_FP_EXCEPT_T
+
/* fp_trap is present */
#undef HAVE_FP_TRAP
Index: libgfortran/configure
===================================================================
--- libgfortran/configure (Revision 200359)
+++ libgfortran/configure (Arbeitskopie)
@@ -25977,7 +25977,28 @@ $as_echo "#define HAVE_FPSETMASK 1" >>confdefs.h
fi
+ac_fn_c_check_type "$LINENO" "fp_except" "ac_cv_type_fp_except" "#include <ieeefp.h>
+"
+if test "x$ac_cv_type_fp_except" = x""yes; then :
+cat >>confdefs.h <<_ACEOF
+#define HAVE_FP_EXCEPT 1
+_ACEOF
+
+
+fi
+ac_fn_c_check_type "$LINENO" "fp_except_t" "ac_cv_type_fp_except_t" "#include <ieeefp.h>
+"
+if test "x$ac_cv_type_fp_except_t" = x""yes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_FP_EXCEPT_T 1
+_ACEOF
+
+
+fi
+
+
# Check for AIX fp_trap and fp_enable
ac_fn_c_check_func "$LINENO" "fp_trap" "ac_cv_func_fp_trap"
if test "x$ac_cv_func_fp_trap" = x""yes; then :
Index: libgfortran/configure.ac
===================================================================
--- libgfortran/configure.ac (Revision 200359)
+++ libgfortran/configure.ac (Arbeitskopie)
@@ -498,6 +498,7 @@ fi
# Check for SysV fpsetmask
LIBGFOR_CHECK_FPSETMASK
+AC_CHECK_TYPES([fp_except,fp_except_t], [], [], [[#include <ieeefp.h>]])
# Check for AIX fp_trap and fp_enable
AC_CHECK_FUNC([fp_trap],[have_fp_trap=yes AC_DEFINE([HAVE_FP_TRAP],[1],[fp_trap is present])])