Patchwork [libfortran] PR 48977 -ffpe-trap=denormal on glibc systems

login
register
mail settings
Submitter Janne Blomqvist
Date May 20, 2011, 1:28 p.m.
Message ID <BANLkTi=ZQWnHgRxY9J3p0P8QkJuGwBS3BQ@mail.gmail.com>
Download mbox | patch
Permalink /patch/96602/
State New
Headers show

Comments

Janne Blomqvist - May 20, 2011, 1:28 p.m.
Hi,

the attached patch makes libgfortran prefer the x86 asm implementation
of setting FPU traps instead of using glibc feenableexcept(). This
enables to trap on denormals, which glibc doesn't support. Contrary to
the original patch in the PR, this swaps only glibc and x86
priorities, as using the x86 implementation on Solaris can cause
debugging issues.

However, due to the fpu-sysv implementation apparently being broken
(PR 48982) Solaris will so far use the x86 implementation as it has
done for a long time (that is, this patch should not introduce any new
breakage on Solaris). But once 48982 is fixed, this problem should be
taken care of as well.

Regtested on x86_64-unknown-linux-gnu, Ok for trunk?

2011-05-20  Janne Blomqvist  <jb@gcc.gnu.org>
	Uros Bizjak  <ubizjak@gmail.com>

	PR libfortran/48977
	* configure.host: Swap order of glibc and x86 tests.

Patch

diff --git a/libgfortran/configure.host b/libgfortran/configure.host
index eb68c93..92b6433 100644
--- a/libgfortran/configure.host
+++ b/libgfortran/configure.host
@@ -20,17 +20,17 @@ 
 # DEFAULTS
 fpu_host='fpu-generic'
 
-# HOST-SPECIFIC OVERRIDES
+if test "x${have_feenableexcept}" = "xyes"; then
+  fpu_host='fpu-glibc'
+fi
+
+# x86 asm should be used instead of glibc, since glibc doesn't support
+# the x86 denormal exception.
 case "${host_cpu}" in
   i?86 | x86_64)
     fpu_host='fpu-387' ;;
 esac
 
-# CONFIGURATION-SPECIFIC OVERRIDES
-if test "x${have_feenableexcept}" = "xyes"; then
-  fpu_host='fpu-glibc'
-fi
-
 if test "x${have_fpsetmask}" = "xyes"; then
   fpu_host='fpu-sysv'
 fi