aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Smith <dannysmith@users.sourceforge.net>2005-10-08 02:14:45 +0000
committerDanny Smith <dannysmith@users.sourceforge.net>2005-10-08 02:14:45 +0000
commita1745937224b08b365b1fbc9e661fa859aa4da71 (patch)
treeef9b65f89f292642c108ef638ce64472797e659d
parentf011605a90b94eb144cb7e9923088fa6fd4d377a (diff)
downloadnewlib-a1745937224b08b365b1fbc9e661fa859aa4da71.zip
newlib-a1745937224b08b365b1fbc9e661fa859aa4da71.tar.gz
newlib-a1745937224b08b365b1fbc9e661fa859aa4da71.tar.bz2
* mingwex/fegetenv.c (fegetenv): Restore exception masks.
* mingwex/feholdexcept.c (feholdexcept): Don't set exceptions to non-stop. Use "fnclex" to clear exception flags.
-rw-r--r--winsup/mingw/ChangeLog6
-rw-r--r--winsup/mingw/mingwex/fegetenv.c6
-rw-r--r--winsup/mingw/mingwex/feholdexcept.c8
3 files changed, 13 insertions, 7 deletions
diff --git a/winsup/mingw/ChangeLog b/winsup/mingw/ChangeLog
index f9ac87b..cef73d7 100644
--- a/winsup/mingw/ChangeLog
+++ b/winsup/mingw/ChangeLog
@@ -1,3 +1,9 @@
+2005-10-08 Danny Smith <dannysmith@users.sourceforge.net>
+
+ * mingwex/fegetenv.c (fegetenv): Restore exception masks.
+ * mingwex/feholdexcept.c (feholdexcept): Don't set exceptions
+ to non-stop. Use "fnclex" to clear exception flags.
+
2005-09-24 Danny Smith <dannysmith@users.sourceforge.net>
* include/math.h (HUGE_VALF, HUGE_VALL, INFINITY, NAN)
diff --git a/winsup/mingw/mingwex/fegetenv.c b/winsup/mingw/mingwex/fegetenv.c
index 5ea5bd0..9301056 100644
--- a/winsup/mingw/mingwex/fegetenv.c
+++ b/winsup/mingw/mingwex/fegetenv.c
@@ -2,11 +2,13 @@
/* 7.6.4.1
The fegetenv function stores the current floating-point environment
- in the object pointed to by envp. */
+ in the object pointed to by envp. */
int fegetenv (fenv_t * envp)
{
__asm__ ("fnstenv %0;": "=m" (*envp));
+ /* fnstenv sets control word to non-stop for all exceptions, so we
+ need to reload our env to restore the original mask. */
+ __asm__ ("fldenv %0" : : "m" (*envp));
return 0;
}
-
diff --git a/winsup/mingw/mingwex/feholdexcept.c b/winsup/mingw/mingwex/feholdexcept.c
index df486af..8d4a3f6 100644
--- a/winsup/mingw/mingwex/feholdexcept.c
+++ b/winsup/mingw/mingwex/feholdexcept.c
@@ -8,11 +8,9 @@
int feholdexcept (fenv_t * envp)
{
- fenv_t tmp_env;
__asm__ ("fnstenv %0;" : "=m" (* envp)); /* save current into envp */
- tmp_env = * envp;
- tmp_env.__status_word &= ~FE_ALL_EXCEPT; /* clear exception flags */
- tmp_env.__control_word |= FE_ALL_EXCEPT; /* set cw to non-stop */
- __asm__ volatile ("fldenv %0;" : : "m" (tmp_env)); /* install the copy */
+ /* fnstenv sets control word to non-stop for all exceptions, so all we
+ need to do is clear the exception flags. */
+ __asm__ ("fnclex");
return 0;
}