[libc-commits] [libc] 1d87465 - [libc][math] fmod: clear exceptions before the test instead of after

Benjamin Kramer via libc-commits libc-commits at lists.llvm.org
Tue May 7 06:29:15 PDT 2024


Author: Benjamin Kramer
Date: 2024-05-07T15:27:55+02:00
New Revision: 1d87465a0a95cee9accc5dce7abdabbbc3f3c122

URL: https://github.com/llvm/llvm-project/commit/1d87465a0a95cee9accc5dce7abdabbbc3f3c122
DIFF: https://github.com/llvm/llvm-project/commit/1d87465a0a95cee9accc5dce7abdabbbc3f3c122.diff

LOG: [libc][math] fmod: clear exceptions before the test instead of after

The test has no control over the CPU state before the test runs.

This test checks whether no exception flags are set, which may not be
true at the start of the test. This used to be not a problem because the
check was broken but that was fixed in ecfb5d9951554d8bdb6a499c958f48cc35f78a88

Added: 
    

Modified: 
    libc/test/src/math/FModTest.h

Removed: 
    


################################################################################
diff  --git a/libc/test/src/math/FModTest.h b/libc/test/src/math/FModTest.h
index f1015d6497fcd..32c009ab88286 100644
--- a/libc/test/src/math/FModTest.h
+++ b/libc/test/src/math/FModTest.h
@@ -18,10 +18,10 @@
 #include "hdr/math_macros.h"
 
 #define TEST_SPECIAL(x, y, expected, dom_err, expected_exception)              \
+  LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT);                         \
   EXPECT_FP_EQ(expected, f(x, y));                                             \
   EXPECT_MATH_ERRNO((dom_err) ? EDOM : 0);                                     \
-  EXPECT_FP_EXCEPTION(expected_exception);                                     \
-  LIBC_NAMESPACE::fputil::clear_except(FE_ALL_EXCEPT)
+  EXPECT_FP_EXCEPTION(expected_exception)
 
 #define TEST_REGULAR(x, y, expected) TEST_SPECIAL(x, y, expected, false, 0)
 


        


More information about the libc-commits mailing list