diff --git a/libc/test/src/fenv/enabled_exceptions_test.cpp b/libc/test/src/fenv/enabled_exceptions_test.cpp --- a/libc/test/src/fenv/enabled_exceptions_test.cpp +++ b/libc/test/src/fenv/enabled_exceptions_test.cpp @@ -27,6 +27,9 @@ int excepts[] = {FE_DIVBYZERO, FE_INVALID, FE_INEXACT, FE_OVERFLOW, FE_UNDERFLOW}; + constexpr int allExcepts = + FE_DIVBYZERO | FE_INVALID | FE_INEXACT | FE_OVERFLOW | FE_UNDERFLOW; + for (int e : excepts) { ASSERT_DEATH( [=] { @@ -36,7 +39,7 @@ // Raising all exceptions except |e| should not call the // SIGFPE handler. They should set the exception flag though, // so we verify that. - int others = FE_ALL_EXCEPT & ~e; + int others = allExcepts & ~e; ASSERT_EQ(__llvm_libc::feraiseexcept(others), 0); ASSERT_EQ(__llvm_libc::fetestexcept(others), others); diff --git a/libc/test/src/fenv/exception_status_test.cpp b/libc/test/src/fenv/exception_status_test.cpp --- a/libc/test/src/fenv/exception_status_test.cpp +++ b/libc/test/src/fenv/exception_status_test.cpp @@ -111,5 +111,8 @@ int r = __llvm_libc::feraiseexcept(FE_ALL_EXCEPT); ASSERT_EQ(r, 0); int s = __llvm_libc::fetestexcept(FE_ALL_EXCEPT); - ASSERT_EQ(s, FE_ALL_EXCEPT); + // ASSERT_EQ(s, FE_ALL_EXCEPT); + for (int e : excepts) { + ASSERT_NE(s & e, 0); + } }