I fixed two class of warnings reported by the Infer static analyzer tool:
- Dead Store(DEAD_STORE)
- Null Dereference(NULLPTR_DEREFERENCE)
I fixed two class of warnings reported by the Infer static analyzer tool:
Fix DEAD_STORE warnings found by the Infer static analyzer tool:
src/policy/fees/block_policy_estimator.cpp:881: error: Dead Store(DEAD_STORE)
The value written to `&median` is never used.
879. }
880.
881. double median = -1;
^
882. EstimationResult tempResult;
883.
src/test/scriptnum_tests.cpp:58: error: Dead Store(DEAD_STORE)
The value written to `&bignum3` is never used.
56. const CScriptNum scriptnum1(num1);
57. const CScriptNum scriptnum2(num2);
58. CScriptNum10 bignum3(num1);
^
59. CScriptNum10 bignum4(num1);
60. CScriptNum scriptnum3(num1);
src/test/scriptnum_tests.cpp:59: error: Dead Store(DEAD_STORE)
The value written to `&bignum4` is never used.
57. const CScriptNum scriptnum2(num2);
58. CScriptNum10 bignum3(num1);
59. CScriptNum10 bignum4(num1);
^
60. CScriptNum scriptnum3(num1);
61. CScriptNum scriptnum4(num1);
src/test/scriptnum_tests.cpp:60: error: Dead Store(DEAD_STORE)
The value written to `&scriptnum3` is never used.
58. CScriptNum10 bignum3(num1);
59. CScriptNum10 bignum4(num1);
60. CScriptNum scriptnum3(num1);
^
61. CScriptNum scriptnum4(num1);
62.
src/test/scriptnum_tests.cpp:61: error: Dead Store(DEAD_STORE)
The value written to `&scriptnum4` is never used.
59. CScriptNum10 bignum4(num1);
60. CScriptNum scriptnum3(num1);
61. CScriptNum scriptnum4(num1);
^
62.
63. // int64_t overflow is undefined.
src/util/subprocess.h:1263: error: Dead Store(DEAD_STORE)
The value written to `&sys_ret` is never used.
1261. #ifndef WIN32
1262. inline void Child::execute_child() {
1263. int sys_ret = -1;
^
1264. auto& stream = parent_->stream_;
1265.
src/validation.cpp:997: error: Dead Store(DEAD_STORE)
The value written to `&newFeeRate` is never used.
995. TxValidationState& state = ws.m_state;
996.
997. CFeeRate newFeeRate(ws.m_modified_fees, ws.m_vsize);
^
998.
999. CTxMemPool::setEntries all_conflicts;
src/wallet/migrate.cpp:538: error: Dead Store(DEAD_STORE)
The value written to `&page_size` is never used.
536. }
537.
538. uint32_t page_size = 4096; // Default page size
^
539.
540. // Read the outer metapage
src/util/subprocess.h:488: error: Dead Store(DEAD_STORE)
The value written to `&fill_sz` is never used.
486. } else { // Partial data ? Continue reading
487. total_bytes_read += rd_bytes;
488. fill_sz -= rd_bytes;
^
489. break;
490. }
Fix a NULLPTR_DEREFERENCE warning:
src/wallet/external_signer_scriptpubkeyman.cpp:71: error: Null Dereference(NULLPTR_DEREFERENCE)
`provider.__infer_backing_pointer` could be null (from the call to `wallet::DescriptorScriptPubKeyMan::GetSolvingProvider()` on line 70) and is dereferenced.
69. const CScript& scriptPubKey = GetScriptForDestination(dest);
70. auto provider = GetSolvingProvider(scriptPubKey);
71. auto descriptor = InferDescriptor(scriptPubKey, *provider);
^
72.
73. const UniValue& result = signer.DisplayAddress(descriptor->ToString());<!--e57a25ab6845829454e8d69fc972939a-->
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
<!--006a51241073e994b41acfe9ec718e94-->
For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/35732.
<!--021abf342d371248e50ceaed478a90ca-->
See the guideline and AI policy for information on the review process. A summary of reviews will appear here.
<!--5faf32d7da4f0f540f40219e4f7537a3-->
Thanks for your submission! The description and code changes match a pattern we sometimes see with PRs that lean heavily on LLM coding assistants. Because the project has such limited human resources for code review, we require code generated by LLMs to be reviewed by the author who submits them first.
It would help to know why you decided to open this PR (did you encounter a bug? find an open issue in repo?), how you reviewed the generated code, what you personally understand about it, how you tested the code before and after the change, etc.
If you don't understand the changes you submitted, we should close this PR. There are many other more helpful ways to contribute to the project, and we look forward to working with you there!
Please also reconsider the value of the PR given how limited our resources are for code review.