about summary refs log tree commit diff
path: root/sysdeps/powerpc/fpu/fesetexcept.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/powerpc/fpu/fesetexcept.c')
-rw-r--r--sysdeps/powerpc/fpu/fesetexcept.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/sysdeps/powerpc/fpu/fesetexcept.c b/sysdeps/powerpc/fpu/fesetexcept.c
index 609a148a95..2850156d3a 100644
--- a/sysdeps/powerpc/fpu/fesetexcept.c
+++ b/sysdeps/powerpc/fpu/fesetexcept.c
@@ -31,6 +31,11 @@ fesetexcept (int excepts)
 	    & FE_INVALID_SOFTWARE));
   if (n.l != u.l)
     {
+      if (n.l & fenv_exceptions_to_reg (excepts))
+	/* Setting the exception flags may trigger a trap.  ISO C 23 ยง 7.6.4.4
+	    does not allow it.   */
+	return -1;
+
       fesetenv_register (n.fenv);
 
       /* Deal with FE_INVALID_SOFTWARE not being implemented on some chips.  */