Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Smith <dannysmith@users.sourceforge.net>2005-10-08 06:14:45 +0400
committerDanny Smith <dannysmith@users.sourceforge.net>2005-10-08 06:14:45 +0400
commita1745937224b08b365b1fbc9e661fa859aa4da71 (patch)
treeef9b65f89f292642c108ef638ce64472797e659d /winsup/mingw/mingwex
parentf011605a90b94eb144cb7e9923088fa6fd4d377a (diff)
* mingwex/fegetenv.c (fegetenv): Restore exception masks.
* mingwex/feholdexcept.c (feholdexcept): Don't set exceptions to non-stop. Use "fnclex" to clear exception flags.
Diffstat (limited to 'winsup/mingw/mingwex')
-rw-r--r--winsup/mingw/mingwex/fegetenv.c6
-rw-r--r--winsup/mingw/mingwex/feholdexcept.c8
2 files changed, 7 insertions, 7 deletions
diff --git a/winsup/mingw/mingwex/fegetenv.c b/winsup/mingw/mingwex/fegetenv.c
index 5ea5bd011..930105673 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 df486afb3..8d4a3f67b 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;
}