about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--sysdeps/powerpc/fpu/fsetexcptflg.c5
2 files changed, 9 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 2cf36488c2..6a2e39cfb2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2016-08-10  Joseph Myers  <joseph@codesourcery.com>
 
+	[BZ #20455]
+	* sysdeps/powerpc/fpu/fsetexcptflg.c (__fesetexceptflag): Mask out
+	all FE_INVALID sub-exceptions from FPSCR when FE_INVALID specified
+	to be restored.
+
 	* math/test-fexcept-traps.c: New file.
 	* math/test-fexcept.c: Likewise.
 	* math/Makefile (tests): Add test-fexcept and test-fexcept-traps.
diff --git a/sysdeps/powerpc/fpu/fsetexcptflg.c b/sysdeps/powerpc/fpu/fsetexcptflg.c
index a06640593c..cb440d570d 100644
--- a/sysdeps/powerpc/fpu/fsetexcptflg.c
+++ b/sysdeps/powerpc/fpu/fsetexcptflg.c
@@ -31,7 +31,10 @@ __fesetexceptflag (const fexcept_t *flagp, int excepts)
   flag = *flagp & excepts;
 
   /* Replace the exception status */
-  n.l = ((u.l & ~(FPSCR_STICKY_BITS & excepts))
+  int excepts_mask = FPSCR_STICKY_BITS & excepts;
+  if ((excepts & FE_INVALID) != 0)
+    excepts_mask |= FE_ALL_INVALID;
+  n.l = ((u.l & ~excepts_mask)
 	 | (flag & FPSCR_STICKY_BITS)
 	 | (flag >> ((31 - FPSCR_VX) - (31 - FPSCR_VXSOFT))
 	    & FE_INVALID_SOFTWARE));