This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC 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: Sun, 23 Jun 2013 00:30:06 +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>
Eric Botcazou wrote:
My autoconf foo does not seem to be strong enough for libgfortran,
but I assume checking for both types and then using #ifdef HAVE_FP_EXCEPT_T
...#elif HAVE_FP_EXCEPT...#endif ought to work?
Yes, I think that we just need to patch the LIBGFOR_CHECK_FPSETMASK check in
acinclude.m4 so as to also test the return type of the function.
Eric: I have a Solaris question. In acinclude.m4, one has:
#if HAVE_FLOATINGPOINT_H
# include <floatingpoint.h>
#endif /* HAVE_FLOATINGPOINT_H */
Should one also include that file? Currently, only ieeefp.h is included
via libgfortran.h.
Gerald and Eric: Would the following work for you? (Sorry, no
config.h.in/configure patch; I haven't build in maintainer's mode, yet.)
--------------- Cut --------------------------
diff --git a/libgfortran/config/fpu-sysv.h b/libgfortran/config/fpu-sysv.h
index 1502b37..db95e9d 100644
--- a/libgfortran/config/fpu-sysv.h
+++ b/libgfortran/config/fpu-sysv.h
@@ -87,3 +87,9 @@ 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
diff --git a/libgfortran/configure.ac b/libgfortran/configure.ac
index ba14f1f..a2add6d 100644
--- a/libgfortran/configure.ac
+++ b/libgfortran/configure.ac
@@ -500,2 +500,3 @@ fi
LIBGFOR_CHECK_FPSETMASK
+AC_CHECK_TYPES([fp_except fp_except_t], [], [], [[#include <ieeefp.h>]])
--------------- Cut --------------------------
Tobias