On these platforms, FE_ALL_EXCEPT contains additional bits.
* tests/test-fenv-except-tracking-1.c (FE_VXSOFT, FE_VXZDZ): Define
fallbacks.
(main): Allow fetestexcept(FE_ALL_EXCEPT) to contain FE_VXSOFT or
FE_VXZDZ in addition to FE_INVALID.
* tests/test-fenv-except-tracking-4.c (FE_VXSOFT): Define fallback.
(main): Allow fetestexcept(FE_ALL_EXCEPT) to contain FE_VXSOFT in
addition to FE_INVALID.
* tests/test-fenv-env-2.c: Likewise.
* tests/test-fenv-env-3.c: Likewise.
* tests/test-fenv-env-4.c: Likewise.
* tests/test-fenv-env-5.c: Likewise.
+2024-01-19 Bruno Haible <bruno@clisp.org>
+
+ fenv-*: Avoid test failures on FreeBSD/powerpc64 and NetBSD/powerpc.
+ On these platforms, FE_ALL_EXCEPT contains additional bits.
+ * tests/test-fenv-except-tracking-1.c (FE_VXSOFT, FE_VXZDZ): Define
+ fallbacks.
+ (main): Allow fetestexcept(FE_ALL_EXCEPT) to contain FE_VXSOFT or
+ FE_VXZDZ in addition to FE_INVALID.
+ * tests/test-fenv-except-tracking-4.c (FE_VXSOFT): Define fallback.
+ (main): Allow fetestexcept(FE_ALL_EXCEPT) to contain FE_VXSOFT in
+ addition to FE_INVALID.
+ * tests/test-fenv-env-2.c: Likewise.
+ * tests/test-fenv-env-3.c: Likewise.
+ * tests/test-fenv-env-4.c: Likewise.
+ * tests/test-fenv-env-5.c: Likewise.
+
2024-01-19 Bruno Haible <bruno@clisp.org>
fenv-*: Fix test failures on NetBSD 9.3/arm64.
/* Test the combination of fegetenv() with fesetenv(). */
+/* On *BSD/powerpc systems, raising FE_INVALID also sets FE_VXSOFT. */
+#ifndef FE_VXSOFT
+# define FE_VXSOFT 0
+#endif
+
int
main ()
{
ASSERT (fegetenv (&env2) == 0);
/* Check that the exception flags are unmodified. */
- ASSERT (fetestexcept (FE_ALL_EXCEPT) == (supports_tracking ? FE_INVALID | FE_OVERFLOW | FE_INEXACT : 0));
+ if (supports_tracking)
+ ASSERT ((fetestexcept (FE_ALL_EXCEPT) & ~FE_VXSOFT) == (FE_INVALID | FE_OVERFLOW | FE_INEXACT));
+ else
+ ASSERT (fetestexcept (FE_ALL_EXCEPT) == 0);
/* Check that the exception trap bits are unmodified. */
ASSERT (fegetexcept () == (supports_trapping ? FE_DIVBYZERO : 0));
/* Check that the rounding direction has been restored. */
ASSERT (fegetround () == FE_UPWARD);
/* Check that the exception flags have been restored. */
- ASSERT (fetestexcept (FE_ALL_EXCEPT) == (supports_tracking ? FE_INVALID | FE_OVERFLOW | FE_INEXACT : 0));
+ if (supports_tracking)
+ ASSERT ((fetestexcept (FE_ALL_EXCEPT) & ~FE_VXSOFT) == (FE_INVALID | FE_OVERFLOW | FE_INEXACT));
+ else
+ ASSERT (fetestexcept (FE_ALL_EXCEPT) == 0);
/* Check that the exception trap bits have been restored. */
ASSERT (fegetexcept () == (supports_trapping ? FE_DIVBYZERO : 0));
/* Test the combination of fegetenv() with feupdateenv(). */
+/* On *BSD/powerpc systems, raising FE_INVALID also sets FE_VXSOFT. */
+#ifndef FE_VXSOFT
+# define FE_VXSOFT 0
+#endif
+
int
main ()
{
ASSERT (fegetenv (&env2) == 0);
/* Check that the exception flags are unmodified. */
- ASSERT (fetestexcept (FE_ALL_EXCEPT) == (supports_tracking ? FE_INVALID | FE_OVERFLOW | FE_INEXACT : 0));
+ if (supports_tracking)
+ ASSERT ((fetestexcept (FE_ALL_EXCEPT) & ~FE_VXSOFT) == (FE_INVALID | FE_OVERFLOW | FE_INEXACT));
+ else
+ ASSERT (fetestexcept (FE_ALL_EXCEPT) == 0);
/* Check that the exception trap bits are unmodified. */
ASSERT (fegetexcept () == (supports_trapping ? FE_DIVBYZERO : 0));
/* Check that the exception flags are the union of the saved and of the
current exception flags. (The saved exception flags happen to be none
in this case.) */
- ASSERT (fetestexcept (FE_ALL_EXCEPT) == (supports_tracking ? FE_INVALID | FE_OVERFLOW | FE_INEXACT : 0));
+ if (supports_tracking)
+ ASSERT ((fetestexcept (FE_ALL_EXCEPT) & ~FE_VXSOFT) == (FE_INVALID | FE_OVERFLOW | FE_INEXACT));
+ else
+ ASSERT (fetestexcept (FE_ALL_EXCEPT) == 0);
/* Check that the exception trap bits have been restored. */
ASSERT (fegetexcept () == 0);
ASSERT (fegetround () == FE_UPWARD);
/* Check that the exception flags are the union of the saved and of the
current exception flags. */
- ASSERT (fetestexcept (FE_ALL_EXCEPT) == (supports_tracking ? FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT : 0));
+ if (supports_tracking)
+ ASSERT ((fetestexcept (FE_ALL_EXCEPT) & ~FE_VXSOFT) == (FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT));
+ else
+ ASSERT (fetestexcept (FE_ALL_EXCEPT) == 0);
/* Check that the exception trap bits have been restored. */
ASSERT (fegetexcept () == (supports_trapping ? FE_DIVBYZERO : 0));
/* Check that the rounding direction has been restored,
whereas the exception flags are unmodified. */
ASSERT (fegetround () == FE_TONEAREST);
- ASSERT (fetestexcept (FE_ALL_EXCEPT) == (supports_tracking ? FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT : 0));
+ if (supports_tracking)
+ ASSERT ((fetestexcept (FE_ALL_EXCEPT) & ~FE_VXSOFT) == (FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT));
+ else
+ ASSERT (fetestexcept (FE_ALL_EXCEPT) == 0);
/* Enable trapping on FE_INVALID. */
feclearexcept (FE_INVALID);
/* Test the combination of feholdexcept() with fesetenv(). */
+/* On *BSD/powerpc systems, raising FE_INVALID also sets FE_VXSOFT. */
+#ifndef FE_VXSOFT
+# define FE_VXSOFT 0
+#endif
+
int
main ()
{
/* Check that the rounding direction has been restored. */
ASSERT (fegetround () == FE_UPWARD);
/* Check that the exception flags have been restored. */
- ASSERT (fetestexcept (FE_ALL_EXCEPT) == (supports_tracking ? FE_INVALID | FE_OVERFLOW | FE_INEXACT : 0));
+ if (supports_tracking)
+ ASSERT ((fetestexcept (FE_ALL_EXCEPT) & ~FE_VXSOFT) == (FE_INVALID | FE_OVERFLOW | FE_INEXACT));
+ else
+ ASSERT (fetestexcept (FE_ALL_EXCEPT) == 0);
/* Check that the exception trap bits have been restored. */
ASSERT (fegetexcept () == (supports_trapping ? FE_DIVBYZERO : 0));
/* Test the combination of feholdexcept() with feupdateenv(). */
+/* On *BSD/powerpc systems, raising FE_INVALID also sets FE_VXSOFT. */
+#ifndef FE_VXSOFT
+# define FE_VXSOFT 0
+#endif
+
int
main ()
{
ASSERT (fegetround () == FE_UPWARD);
/* Check that the exception flags are the union of the saved and of the
current exception flags. */
- ASSERT (fetestexcept (FE_ALL_EXCEPT) == (supports_tracking ? FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT : 0));
+ if (supports_tracking)
+ ASSERT ((fetestexcept (FE_ALL_EXCEPT) & ~FE_VXSOFT) == (FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT));
+ else
+ ASSERT (fetestexcept (FE_ALL_EXCEPT) == 0);
/* Check that the exception trap bits have been restored. */
ASSERT (fegetexcept () == (supports_trapping ? FE_DIVBYZERO : 0));
/* Check that the rounding direction has been restored,
whereas the exception flags are unmodified. */
ASSERT (fegetround () == FE_TONEAREST);
- ASSERT (fetestexcept (FE_ALL_EXCEPT) == (supports_tracking ? FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT : 0));
+ if (supports_tracking)
+ ASSERT ((fetestexcept (FE_ALL_EXCEPT) & ~FE_VXSOFT) == (FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW | FE_INEXACT));
+ else
+ ASSERT (fetestexcept (FE_ALL_EXCEPT) == 0);
/* Enable trapping on FE_INVALID. */
feclearexcept (FE_INVALID);
#include "macros.h"
+/* On *BSD/powerpc systems, raising FE_INVALID also sets FE_VXSOFT. */
+#ifndef FE_VXSOFT
+# define FE_VXSOFT 0
+#endif
+#ifndef FE_VXZDZ
+# define FE_VXZDZ 0
+#endif
+
static volatile double a, b, c;
int
ASSERT (/* with the libc's feraiseexcept(): */
fetestexcept (FE_ALL_EXCEPT) == FE_ALL_EXCEPT
|| /* with gnulib's feraiseexcept(): */
- fetestexcept (FE_ALL_EXCEPT)
+ (fetestexcept (FE_ALL_EXCEPT) & ~FE_VXSOFT)
== (FE_DIVBYZERO | FE_INEXACT | FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW));
ASSERT (fetestexcept (FE_INVALID) == FE_INVALID);
ASSERT (fetestexcept (FE_DIVBYZERO) == FE_DIVBYZERO);
/* Test setting just one exception flag: FE_INVALID. */
ASSERT (feclearexcept (FE_ALL_EXCEPT) == 0);
ASSERT (feraiseexcept (FE_INVALID) == 0);
- ASSERT (fetestexcept (FE_ALL_EXCEPT) == FE_INVALID);
+ ASSERT ((fetestexcept (FE_ALL_EXCEPT) & ~FE_VXSOFT) == FE_INVALID);
ASSERT (fetestexcept (FE_INVALID) == FE_INVALID);
ASSERT (fetestexcept (FE_DIVBYZERO) == 0);
ASSERT (fetestexcept (FE_OVERFLOW) == 0);
ASSERT (/* with the libc's feraiseexcept(): */
fetestexcept (FE_ALL_EXCEPT) == (FE_ALL_EXCEPT & ~FE_DIVBYZERO)
|| /* with gnulib's feraiseexcept(): */
- fetestexcept (FE_ALL_EXCEPT)
+ (fetestexcept (FE_ALL_EXCEPT) & ~FE_VXSOFT)
== (FE_INEXACT | FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW));
ASSERT (fetestexcept (FE_INVALID) == FE_INVALID);
ASSERT (fetestexcept (FE_DIVBYZERO) == 0);
ASSERT (/* with the libc's feraiseexcept(): */
fetestexcept (FE_ALL_EXCEPT) == (FE_ALL_EXCEPT & ~FE_OVERFLOW)
|| /* with gnulib's feraiseexcept(): */
- fetestexcept (FE_ALL_EXCEPT)
+ (fetestexcept (FE_ALL_EXCEPT) & ~FE_VXSOFT)
== (FE_DIVBYZERO | FE_INEXACT | FE_INVALID | FE_UNDERFLOW));
ASSERT (fetestexcept (FE_INVALID) == FE_INVALID);
ASSERT (fetestexcept (FE_DIVBYZERO) == FE_DIVBYZERO);
ASSERT (/* with the libc's feraiseexcept(): */
fetestexcept (FE_ALL_EXCEPT) == (FE_ALL_EXCEPT & ~FE_UNDERFLOW)
|| /* with gnulib's feraiseexcept(): */
- fetestexcept (FE_ALL_EXCEPT)
+ (fetestexcept (FE_ALL_EXCEPT) & ~FE_VXSOFT)
== (FE_DIVBYZERO | FE_INEXACT | FE_INVALID | FE_OVERFLOW));
ASSERT (fetestexcept (FE_INVALID) == FE_INVALID);
ASSERT (fetestexcept (FE_DIVBYZERO) == FE_DIVBYZERO);
ASSERT (/* with the libc's feraiseexcept(): */
fetestexcept (FE_ALL_EXCEPT) == (FE_ALL_EXCEPT & ~FE_INEXACT)
|| /* with gnulib's feraiseexcept(): */
- fetestexcept (FE_ALL_EXCEPT)
+ (fetestexcept (FE_ALL_EXCEPT) & ~FE_VXSOFT)
== (FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW));
ASSERT (fetestexcept (FE_INVALID) == FE_INVALID);
ASSERT (fetestexcept (FE_DIVBYZERO) == FE_DIVBYZERO);
/* Test the effects of an operation that produces FE_INVALID. */
ASSERT (feclearexcept (FE_ALL_EXCEPT) == 0);
a = 0; b = 0; c = a / b;
- ASSERT (fetestexcept (FE_ALL_EXCEPT) == FE_INVALID);
+ ASSERT ((fetestexcept (FE_ALL_EXCEPT) & ~FE_VXZDZ) == FE_INVALID);
ASSERT (fetestexcept (FE_INVALID) == FE_INVALID);
ASSERT (fetestexcept (FE_DIVBYZERO) == 0);
ASSERT (fetestexcept (FE_OVERFLOW) == 0);
/* Check that fesetexcept() works. */
+/* On *BSD/powerpc systems, raising FE_INVALID also sets FE_VXSOFT. */
+#ifndef FE_VXSOFT
+# define FE_VXSOFT 0
+#endif
+
int
main ()
{
/* Test setting just one exception flag: FE_INVALID. */
ASSERT (feclearexcept (FE_ALL_EXCEPT) == 0);
ASSERT (fesetexcept (FE_INVALID) == 0);
- ASSERT (fetestexcept (FE_ALL_EXCEPT) == FE_INVALID);
+ ASSERT ((fetestexcept (FE_ALL_EXCEPT) & ~FE_VXSOFT) == FE_INVALID);
ASSERT (fetestexcept (FE_INVALID) == FE_INVALID);
ASSERT (fetestexcept (FE_DIVBYZERO) == 0);
ASSERT (fetestexcept (FE_OVERFLOW) == 0);