-Wlogical-op warning in wallet/scriptpubkeyman.cpp when building current master #19912

issue kristapsk opened this issue on September 7, 2020
  1. kristapsk commented at 8:54 PM on September 7, 2020: contributor
    wallet/scriptpubkeyman.cpp: In member function ‘virtual bool LegacyScriptPubKeyMan::Upgrade(int, bilingual_str&)’:
    wallet/scriptpubkeyman.cpp:455:55: warning: logical ‘and’ applied to non-boolean constant [-Wlogical-op]
      455 |     if (m_storage.CanSupportFeature(FEATURE_HD_SPLIT) && CHDChain::VERSION_HD_CHAIN_SPLIT) {
          |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      CXX      wallet/libbitcoin_wallet_a-wallet.o
    
    $ gcc --version
    gcc (Gentoo 9.2.0-r2 p3) 9.2.0
    

    Related - #19015.

  2. kristapsk added the label Bug on Sep 7, 2020
  3. practicalswift cross-referenced this on Sep 8, 2020 from issue build: Enable some commonly enabled compiler diagnostics by practicalswift
  4. practicalswift commented at 5:00 AM on September 8, 2020: contributor

    Thanks for reporting! Very nice to see the recently enabled -Wlogical-op pay off. Time for -Werror=logical-op?

  5. achow101 commented at 5:26 AM on September 8, 2020: member

    #18836 fixes this.

  6. practicalswift commented at 5:32 AM on September 8, 2020: contributor

    @achow101 Thanks! I guess #18836 will need additional review time given its size/scope: would it make sense to patch this separately to get the fix in sooner?

  7. maskoficarus cross-referenced this on Sep 20, 2020 from issue refactor: clean up -Wlogical-op warning in wallet/scriptpubkeyman.cpp by maskoficarus
  8. maskoficarus commented at 8:13 PM on September 20, 2020: none

    I've added a standalone fix in #19986 to get this resolved while #18836 gets sorted out.

  9. jonatack commented at 7:01 AM on September 21, 2020: contributor

    Interesting. I compile with this flag and am not seeing this. Just reverified on both gcc and clang.

    $ gcc --version
    gcc (Debian 10.2.0-7) 10.2.0
    $ clang --version
    Debian clang version 12.0.0
    
  10. hebasto commented at 3:11 PM on October 18, 2020: member

    gcc 10.2.1 (Fedora 32) -- no warnings gcc 9.3.0 (Linux Mint 20 / Ubuntu Focal) -- a warning is emitted

  11. hebasto referenced this in commit 5de9689580 on Oct 18, 2020
  12. fanquake closed this on Oct 19, 2020

  13. fanquake referenced this in commit a1e0359618 on Oct 19, 2020
  14. sidhujag referenced this in commit cfc58deb8b on Oct 19, 2020
  15. kristapsk cross-referenced this on Dec 18, 2020 from issue Non-boolean const value in && expression. by kallewoof
  16. Fabcien referenced this in commit a46f4c08b3 on Nov 25, 2021
  17. bitcoin locked this on Feb 15, 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: 2026-05-19 06:53 UTC