False positive -Wmaybe-uninitialized warning of GCC 10.2 #21318

issue hebasto openend this issue on February 28, 2021
  1. hebasto commented at 6:03 pm on February 28, 2021: member

    On the master (e52ce9f2b312b3cf3b0837918e07d7603e241d63):

    0$ ./configure CC=gcc-10 CXX=g++-10
    1$ make clean > /dev/null
    2$ make > /dev/null
    3txmempool.cpp: In member function CTxMemPool::setEntries CTxMemPool::GetIterSet(const std::set<uint256>&) const:
    4txmempool.cpp:894:29: warning: <anonymous> may be used uninitialized in this function [-Wmaybe-uninitialized]
    5  894 |     return Optional<txiter>{};
    6      |                             ^
    

    The following patch

     0--- a/src/txmempool.cpp
     1+++ b/src/txmempool.cpp
     2@@ -891,7 +891,7 @@ Optional<CTxMemPool::txiter> CTxMemPool::GetIter(const uint256& txid) const
     3 {
     4     auto it = mapTx.find(txid);
     5     if (it != mapTx.end()) return it;
     6-    return Optional<txiter>{};
     7+    return {};
     8 }
     9 
    10 CTxMemPool::setEntries CTxMemPool::GetIterSet(const std::set<uint256>& hashes) const
    

    doesn’t help.


    System:

    0$ lsb_release -dc
    1Description:	Linux Mint 20.1
    2Codename:	ulyssa
    3$ g++-10 --version | grep g++
    4g++-10 (Ubuntu 10.2.0-5ubuntu1~20.04) 10.2.0
    
  2. jarolrod commented at 6:06 pm on February 28, 2021: member
    @hebasto I opened this before #21248, It has also been opened a couple of times before I did. Seems to just be a false positive
  3. hebasto closed this on Feb 28, 2021

  4. fanquake referenced this in commit 5294f0d5a9 on Mar 22, 2021
  5. MarcoFalke referenced this in commit 786654aa5e on Mar 22, 2021
  6. sidhujag referenced this in commit 9f12fb3d2e on Mar 22, 2021
  7. DrahtBot locked this on Aug 18, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-12-18 18:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me