[libc-commits] [PATCH] D139566: [libc] Fix undefined behavior in UInt<>::shift_right.
Michael Jones via Phabricator via libc-commits
libc-commits at lists.llvm.org
Wed Dec 7 13:13:04 PST 2022
michaelrj accepted this revision.
michaelrj added inline comments.
This revision is now accepted and ready to land.
================
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);
----------------
lntue wrote:
> 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.
SGTM
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