build: fix clang -Wshorten-64-to-32 warnings#1801
build: fix clang -Wshorten-64-to-32 warnings#1801csjones wants to merge 4 commits intobitcoin-core:masterfrom
Conversation
…ion' warnings in scalar_4x64_impl.h
|
Can you squash the last two commits? |
…ion' warnings in hash_impl.h fix: correct cast placement in hash_impl.h to preserve full 64-bit shift operations
98749c3 to
4a84fb7
Compare
|
@real-or-random just pushed the squashed commit. |
real-or-random
left a comment
There was a problem hiding this comment.
cc @sipa for the w change... Is this correct even? Even if it's correct, do we want to keep the smaller uint32_t?
| p4 = (uint32_t)c0 + m6; | ||
| VERIFY_CHECK(p4 <= 2); |
There was a problem hiding this comment.
| p4 = (uint32_t)c0 + m6; | |
| VERIFY_CHECK(p4 <= 2); | |
| VERIFY_CHECK(c0 <= 1 && m6 <= 1); | |
| p4 = (uint32_t)c0 + m6; |
There was a problem hiding this comment.
I ended up removing m6 <= 1 because it's already verified at line 637. The CI failed with c0 <= 1 and after running the ci script locally a few times, I changed it to c0 <= 2, which is consistent with the original p4 <= 2 check (since p4 = c0 + m6 and m6 <= 1). I also restored the p4 <= 2 check.
There was a problem hiding this comment.
Hm, I see. I have no idea how the algorithm works. Still, this is a bit surprising to me because that means m6 == 0 always (but then it probably wouldn't be there in the first place) or m6 == 0 iff c0 == 2, and I don't see why the latter should hold.
Perhaps @sipa can provide some insights..
…asts in scalar_4x64_impl.h
9e3dc93 to
da9db68
Compare
Addressing most of the remaining build warnings from issue thread #1617.
I used master branch @ 4721e07 with command:
cmake -B build \ -DCMAKE_C_COMPILER=clang \ -DSECP256K1_ENABLE_MODULE_ECDH=ON \ -DSECP256K1_ENABLE_MODULE_RECOVERY=ON \ -DSECP256K1_ENABLE_MODULE_EXTRAKEYS=ON \ -DSECP256K1_ENABLE_MODULE_SCHNORRSIG=ON \ -DSECP256K1_ENABLE_MODULE_MUSIG=ON \ -DSECP256K1_ENABLE_MODULE_ELLSWIFT=ON \ -DSECP256K1_BUILD_TESTS=OFF \ -DSECP256K1_BUILD_EXHAUSTIVE_TESTS=OFF \ -DSECP256K1_BUILD_CTIME_TESTS=OFF \ -DSECP256K1_BUILD_BENCHMARK=OFF \ -DSECP256K1_BUILD_EXAMPLES=OFF \ -DCMAKE_C_FLAGS="-Wall -Wextra -Wshorten-64-to-32 -Werror=shorten-64-to-32" cmake --build build --verbosewhich produced these 14 errors:
I applied most of the suggested fixes from #1617 (comment) and used an explicit cast of
(uint32_t)inscalar_4x64_impl.hfor the two warnings not mentioned in the original issue thread. The warnings inecmult_impl.hwere skipped.Only two warnings remain after applying the changes from this PR.
EDIT:
Investigating failing CIFixed.