This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[patch][sh] FP exception control.
- From: Andrew Stubbs <ams at codesourcery dot com>
- To: libc-alpha at sourceware dot org
- Date: Mon, 10 May 2010 17:41:02 +0100
- Subject: [patch][sh] FP exception control.
I have found a bug in feholdexcept - it doesn't actually disable any
exceptions! The return code was also incorrect, although accurate, as it
turns out.
Please accept the attached patch that fixes both problems.
Thanks
Andrew
2010-05-07 Andrew Stubbs <ams@codesourcery.com>
* sysdeps/sh/sh4/fpu/feholdexcpt.c (feholdexcept): Really disable all
exceptions.
Return 0.
---
.../sysdeps/sh/sh4/fpu/feholdexcpt.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/glibc-mainline/sysdeps/sh/sh4/fpu/feholdexcpt.c b/src/glibc-mainline/sysdeps/sh/sh4/fpu/feholdexcpt.c
index 7aac5a0..71a95f1 100644
--- a/src/glibc-mainline/sysdeps/sh/sh4/fpu/feholdexcpt.c
+++ b/src/glibc-mainline/sysdeps/sh/sh4/fpu/feholdexcpt.c
@@ -29,10 +29,15 @@ feholdexcept (fenv_t *envp)
_FPU_GETCW (temp);
envp->__fpscr = temp;
- /* Now set all exceptions to non-stop. */
+ /* Clear the status flags. */
temp &= ~FE_ALL_EXCEPT;
+
+ /* Now set all exceptions to non-stop. */
+ temp &= ~(FE_ALL_EXCEPT << 5);
+
_FPU_SETCW (temp);
- return 1;
+ /* Success. */
+ return 0;
}
libm_hidden_def (feholdexcept)