tracing: do not use coin after move in CCoinsViewCache::AddCoin#25663
Merged
maflcko merged 1 commit intobitcoin:masterfrom Aug 1, 2022
Merged
tracing: do not use coin after move in CCoinsViewCache::AddCoin#25663maflcko merged 1 commit intobitcoin:masterfrom
coin after move in CCoinsViewCache::AddCoin#25663maflcko merged 1 commit intobitcoin:masterfrom
Conversation
jonatack
reviewed
Jul 21, 2022
| (bool)coin.IsCoinBase()); | ||
| (uint32_t)it->second.coin.nHeight, | ||
| (int64_t)it->second.coin.out.nValue, | ||
| (bool)it->second.coin.IsCoinBase()); |
Member
There was a problem hiding this comment.
utACK
An alternative would be to move the TRACE5 call before the std::move.
Contributor
|
ACK f8e2284 Changes look good. Ran the functional usdt interface tests (with the commits from #25528 cherry-picked). This branch is currently running in the CI here https://cirrus-ci.com/build/4542423555637248. |
sidhujag
pushed a commit
to syscoin/syscoin
that referenced
this pull request
Aug 1, 2022
…ViewCache::AddCoin` f8e2284 tracing: do not use `coin` after move in `CCoinsViewCache::AddCoin` (Seibart Nedor) Pull request description: This is fix for bitcoin#25640. ACKs for top commit: 0xB10C: ACK f8e2284 Tree-SHA512: e7643ac8e6b6247aaf250f44572c4b458da4aea030ac0268227564e6857200e9c23efe325cfc535f46498cbeccaf46301551efeeb54b062f71d2dcf1ffe71fb8
fanquake
added a commit
to fanquake/bitcoin
that referenced
this pull request
Aug 30, 2022
Will error with:
```bash
coins.cpp:102:22: error: 'coin' used after it was moved [bugprone-use-after-move,-warnings-as-errors]
(uint32_t)coin.nHeight,
^
coins.cpp:96:21: note: move occurred here
it->second.coin = std::move(coin);
```
until bitcoin#25663 is merged.
See:
https://releases.llvm.org/14.0.0/tools/clang/tools/extra/docs/clang-tidy/checks/bugprone-use-after-move.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is fix for #25640.