This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]