[libc-commits] [PATCH] D139566: [libc] Fix undefined behavior in UInt<>::shift_right.

Tue Ly via Phabricator via libc-commits libc-commits at lists.llvm.org
Wed Dec 7 13:10:00 PST 2022


lntue added inline comments.


================
Comment at: libc/test/src/__support/uint_test.cpp:516
 TEST(LlvmLibcUIntClassTest, QuickMulHiTests) {
-  // TODO(lntue): Investigate / Analyze the error bounds for other rounding
-  // modes.  It the error bounds seems to be able to reach to WordCount instead
-  // of WordCount - 1 in the CI environment.
-  TEST_QUICK_MUL_HI(128, 2);
-  TEST_QUICK_MUL_HI(192, 3);
-  TEST_QUICK_MUL_HI(256, 4);
-  TEST_QUICK_MUL_HI(512, 8);
+  TEST_QUICK_MUL_HI(128, 1);
+  TEST_QUICK_MUL_HI(192, 2);
----------------
michaelrj wrote:
> is there a reason that these tests are changed?
Those were the correct bounds of the tests.  Previously these tests failed with the correct bounds, and it turns out because of the undefined behavior in the shift function that is fixed in this patch.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139566/new/

https://reviews.llvm.org/D139566



More information about the libc-commits mailing list