]> git.ipfire.org Git - thirdparty/glibc.git/blobdiff - math/test-fesetexcept-traps.c
powerpc: Do not raise exception traps for fesetexcept/fesetexceptflag (BZ 30988)
[thirdparty/glibc.git] / math / test-fesetexcept-traps.c
index 71b6e45b33d76f5d881c09137f6285ab784f67e9..7efcd0343a6545b7c034af1de27154ccc704b228 100644 (file)
@@ -39,16 +39,24 @@ do_test (void)
       return result;
     }
 
-  if (EXCEPTION_SET_FORCES_TRAP)
-    {
-      puts ("setting exceptions traps, cannot test on this architecture");
-      return 77;
-    }
-  /* Verify fesetexcept does not cause exception traps.  */
+  /* Verify fesetexcept does not cause exception traps.  For architectures
+     where setting the exception might result in traps the function should
+     return a nonzero value.  */
   ret = fesetexcept (FE_ALL_EXCEPT);
+
+  _Static_assert (!(EXCEPTION_SET_FORCES_TRAP && !EXCEPTION_TESTS(float)),
+                 "EXCEPTION_SET_FORCES_TRAP only makes sense if the "
+                 "architecture suports exceptions");
+
   if (ret == 0)
-    puts ("fesetexcept (FE_ALL_EXCEPT) succeeded");
-  else
+    {
+      if (EXCEPTION_SET_FORCES_TRAP)
+       {
+         puts ("unexpected fesetexcept success");
+         result = 1;
+       }
+    }
+  else if (!EXCEPTION_SET_FORCES_TRAP)
     {
       puts ("fesetexcept (FE_ALL_EXCEPT) failed");
       if (EXCEPTION_TESTS (float))