I've applied this further patch to C11-atomic branch to ensure that
the c11-atomic-exec-5.c test is only run where floating-point
exceptions are actually supported, to avoid spurious failures for
soft-float configurations (or any systems that have pthreads but not
<fenv.h>).

2013-11-05  Joseph Myers  <jos...@codesourcery.com>

        * lib/target-supports.exp
        (check_effective_target_fenv_exceptions): New function.
        * gcc.dg/atomic/c11-atomic-exec-5.c: Use
        dg-require-effective-target fenv_exceptions.

Index: gcc/testsuite/lib/target-supports.exp
===================================================================
--- gcc/testsuite/lib/target-supports.exp       (revision 204378)
+++ gcc/testsuite/lib/target-supports.exp       (working copy)
@@ -5477,3 +5477,40 @@ proc check_effective_target_aarch64_large { } {
        return 0
     }
 }
+
+# Return 1 if <fenv.h> is available with all the standard IEEE
+# exceptions and floating-point exceptions are raised by arithmetic
+# operations.  (If the target requires special options for "inexact"
+# exceptions, those need to be specified in the testcases.)
+
+proc check_effective_target_fenv_exceptions {} {
+    return [check_runtime fenv_exceptions {
+       #include <fenv.h>
+       #include <stdlib.h>
+       #ifndef FE_DIVBYZERO
+       # error Missing FE_DIVBYZERO
+       #endif
+       #ifndef FE_INEXACT
+       # error Missing FE_INEXACT
+       #endif
+       #ifndef FE_INVALID
+       # error Missing FE_INVALID
+       #endif
+       #ifndef FE_OVERFLOW
+       # error Missing FE_OVERFLOW
+       #endif
+       #ifndef FE_UNDERFLOW
+       # error Missing FE_UNDERFLOW
+       #endif
+       volatile float a = 0.0f, r;
+       int
+       main (void)
+       {
+         r = a / a;
+         if (fetestexcept (FE_INVALID))
+           exit (0);
+         else
+           abort ();
+       }
+    } "-std=gnu99"]
+}
Index: gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-5.c
===================================================================
--- gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-5.c     (revision 204378)
+++ gcc/testsuite/gcc.dg/atomic/c11-atomic-exec-5.c     (working copy)
@@ -4,6 +4,7 @@
    get properly cleared).  */
 /* { dg-do run } */
 /* { dg-options "-std=c11 -pedantic-errors -pthread -D_POSIX_C_SOURCE=200809L" 
} */
+/* { dg-require-effective-target fenv_exceptions } */
 /* { dg-require-effective-target pthread } */
 
 #include <fenv.h>

-- 
Joseph S. Myers
jos...@codesourcery.com

Reply via email to