Skip to content

fix: compilation error with modern gcc for leveldb subtree#7393

Merged
PastaPastaPasta merged 1 commit into
dashpay:developfrom
knst:fix-gcc-16
Jun 30, 2026
Merged

fix: compilation error with modern gcc for leveldb subtree#7393
PastaPastaPasta merged 1 commit into
dashpay:developfrom
knst:fix-gcc-16

Conversation

@knst

@knst knst commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Issue being fixed or feature implemented

Dash Core's build fails with gcc-16:

In copy constructor 'constexpr leveldb::DBImpl::CompactionState::Output::Output(const leveldb::DBImpl::CompactionState::Output&)',
    inlined from 'constexpr _Tp* std::construct_at(_Tp*, _Args&& ...) [with _Tp = leveldb::DBImpl::CompactionState::Output; _Args = {const leveldb::DBImpl::CompactionState::Output&}]' at /usr/include/c++/16/bits/stl_construct.h:110:9,
    inlined from 'static constexpr void std::allocator_traits<std::allocator<_Up> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = leveldb::DBImpl::CompactionState::Output; _Args = {const leveldb::DBImpl::CompactionState::Output&}; _Tp = leveldb::DBImpl::CompactionState::Output]' at /usr/include/c++/16/bits/alloc_traits.h:716:21,
    inlined from 'constexpr void std::vector<_Tp, _Alloc>::_M_realloc_append(_Args&& ...) [with _Args = {const leveldb::DBImpl::CompactionState::Output&}; _Tp = leveldb::DBImpl::CompactionState::Output; _Alloc = std::allocator<leveldb::DBImpl::CompactionState::Output>]' at /usr/include/c++/16/bits/vector.tcc:594:26,
    inlined from 'constexpr void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = leveldb::DBImpl::CompactionState::Output; _Alloc = std::allocator<leveldb::DBImpl::CompactionState::Output>]' at /usr/include/c++/16/bits/stl_vector.h:1417:21,
    inlined from 'leveldb::Status leveldb::DBImpl::OpenCompactionOutputFile(CompactionState*)' at leveldb/db/db_impl.cc:808:31:
leveldb/db/db_impl.cc:57:10: error: 'out.leveldb::DBImpl::CompactionState::Output::file_size' may be used uninitialized [-Werror=maybe-uninitialized]
   57 |   struct Output {
      |          ^~~~~~
leveldb/db/db_impl.cc: In member function 'leveldb::Status leveldb::DBImpl::OpenCompactionOutputFile(CompactionState*)':
leveldb/db/db_impl.cc:804:29: note: 'out' declared here
  804 |     CompactionState::Output out;

What was done?

Original leveldb's commit is ad9b1c989380538bfb19c5c65df0d3f72d8ed62b Backported to Bitcoin Core by bitcoin#34470 Though, that too many unrelated changes meanwhile. That's temporary fix until leveldb's version won't be properly updated.

How Has This Been Tested?

Together with #7392 I finally compile dash core with gcc 16 again.

Breaking Changes

N/A

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone (for repository code-owners and collaborators only)

In copy constructor 'constexpr leveldb::DBImpl::CompactionState::Output::Output(const leveldb::DBImpl::CompactionState::Output&)',
    inlined from 'constexpr _Tp* std::construct_at(_Tp*, _Args&& ...) [with _Tp = leveldb::DBImpl::CompactionState::Output; _Args = {const leveldb::DBImpl::CompactionState::Output&}]' at /usr/include/c++/16/bits/stl_construct.h:110:9,
    inlined from 'static constexpr void std::allocator_traits<std::allocator<_Up> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = leveldb::DBImpl::CompactionState::Output; _Args = {const leveldb::DBImpl::CompactionState::Output&}; _Tp = leveldb::DBImpl::CompactionState::Output]' at /usr/include/c++/16/bits/alloc_traits.h:716:21,
    inlined from 'constexpr void std::vector<_Tp, _Alloc>::_M_realloc_append(_Args&& ...) [with _Args = {const leveldb::DBImpl::CompactionState::Output&}; _Tp = leveldb::DBImpl::CompactionState::Output; _Alloc = std::allocator<leveldb::DBImpl::CompactionState::Output>]' at /usr/include/c++/16/bits/vector.tcc:594:26,
    inlined from 'constexpr void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = leveldb::DBImpl::CompactionState::Output; _Alloc = std::allocator<leveldb::DBImpl::CompactionState::Output>]' at /usr/include/c++/16/bits/stl_vector.h:1417:21,
    inlined from 'leveldb::Status leveldb::DBImpl::OpenCompactionOutputFile(CompactionState*)' at leveldb/db/db_impl.cc:808:31:
leveldb/db/db_impl.cc:57:10: error: 'out.leveldb::DBImpl::CompactionState::Output::file_size' may be used uninitialized [-Werror=maybe-uninitialized]
   57 |   struct Output {
      |          ^~~~~~
leveldb/db/db_impl.cc: In member function 'leveldb::Status leveldb::DBImpl::OpenCompactionOutputFile(CompactionState*)':
leveldb/db/db_impl.cc:804:29: note: 'out' declared here
  804 |     CompactionState::Output out;

Original leveldb's commit is ad9b1c989380538bfb19c5c65df0d3f72d8ed62b
Backported to Bitcoin Core by bitcoin#34470
Though, that too many unrelated changes meanwhile.
That's temporary fix until leveldb's version won't be properly updated.
@github-actions

Copy link
Copy Markdown

✅ No Merge Conflicts Detected

This PR currently has no conflicts with other open PRs.

@knst knst added this to the 24 milestone Jun 29, 2026
@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: f8f0c79c-96e4-4069-85fd-96e8e7fe6512

📥 Commits

Reviewing files that changed from the base of the PR and between cdcf00a and 75b19b3.

📒 Files selected for processing (1)
  • src/leveldb/db/db_impl.cc

Walkthrough

In DBImpl::OpenCompactionOutputFile, a single line out.file_size = 0 is added when constructing a new CompactionState::Output entry, explicitly initializing the file_size field to zero instead of leaving it with an indeterminate value.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the main change: a GCC compatibility fix for the LevelDB subtree.
Description check ✅ Passed The description directly describes the GCC compilation error and the LevelDB fix being applied.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@thepastaclaw

thepastaclaw commented Jun 29, 2026

Copy link
Copy Markdown

✅ Review complete (commit 75b19b3)

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

Verified PR #7393 against the checked-out source. The change is a single initialization of CompactionState::Output::file_size before the Output object is copied into compact->outputs; successful compaction overwrites it before install, and failed compaction paths do not call InstallCompactionResults, so the change fixes the GCC warning without changing persisted LevelDB behavior.

@knst knst requested review from PastaPastaPasta and UdjinM6 June 30, 2026 07:50

@UdjinM6 UdjinM6 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK 75b19b3

@PastaPastaPasta PastaPastaPasta merged commit b828f81 into dashpay:develop Jun 30, 2026
84 of 85 checks passed
@knst knst deleted the fix-gcc-16 branch June 30, 2026 13:54
PastaPastaPasta added a commit to PastaPastaPasta/dash that referenced this pull request Jun 30, 2026
…b subtree

75b19b3 fix: compilation error with modern gcc for leveldb subtree (Konstantin Akimov)

Pull request description:

  ## Issue being fixed or feature implemented
  Dash Core's build fails with gcc-16:

      In copy constructor 'constexpr leveldb::DBImpl::CompactionState::Output::Output(const leveldb::DBImpl::CompactionState::Output&)',
          inlined from 'constexpr _Tp* std::construct_at(_Tp*, _Args&& ...) [with _Tp = leveldb::DBImpl::CompactionState::Output; _Args = {const leveldb::DBImpl::CompactionState::Output&}]' at /usr/include/c++/16/bits/stl_construct.h:110:9,
          inlined from 'static constexpr void std::allocator_traits<std::allocator<_Up> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = leveldb::DBImpl::CompactionState::Output; _Args = {const leveldb::DBImpl::CompactionState::Output&}; _Tp = leveldb::DBImpl::CompactionState::Output]' at /usr/include/c++/16/bits/alloc_traits.h:716:21,
          inlined from 'constexpr void std::vector<_Tp, _Alloc>::_M_realloc_append(_Args&& ...) [with _Args = {const leveldb::DBImpl::CompactionState::Output&}; _Tp = leveldb::DBImpl::CompactionState::Output; _Alloc = std::allocator<leveldb::DBImpl::CompactionState::Output>]' at /usr/include/c++/16/bits/vector.tcc:594:26,
          inlined from 'constexpr void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = leveldb::DBImpl::CompactionState::Output; _Alloc = std::allocator<leveldb::DBImpl::CompactionState::Output>]' at /usr/include/c++/16/bits/stl_vector.h:1417:21,
          inlined from 'leveldb::Status leveldb::DBImpl::OpenCompactionOutputFile(CompactionState*)' at leveldb/db/db_impl.cc:808:31:
      leveldb/db/db_impl.cc:57:10: error: 'out.leveldb::DBImpl::CompactionState::Output::file_size' may be used uninitialized [-Werror=maybe-uninitialized]
         57 |   struct Output {
            |          ^~~~~~
      leveldb/db/db_impl.cc: In member function 'leveldb::Status leveldb::DBImpl::OpenCompactionOutputFile(CompactionState*)':
      leveldb/db/db_impl.cc:804:29: note: 'out' declared here
        804 |     CompactionState::Output out;

  ## What was done?
  Original leveldb's commit is ad9b1c989380538bfb19c5c65df0d3f72d8ed62b Backported to Bitcoin Core by bitcoin#34470 Though, that too many unrelated changes meanwhile. That's temporary fix until leveldb's version won't be properly updated.

  ## How Has This Been Tested?
  Together with dashpay#7392 I finally compile dash core with gcc 16 again.

  ## Breaking Changes
  N/A

  ## Checklist:
  - [x] I have performed a self-review of my own code
  - [ ] I have commented my code, particularly in hard-to-understand areas
  - [ ] I have added or updated relevant unit/integration/functional/e2e tests
  - [ ] I have made corresponding changes to the documentation
  - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_

ACKs for top commit:
  UdjinM6:
    utACK 75b19b3

Tree-SHA512: 985042f04a4df7b20aaa773d302401af948099ae8c29d6669f0441e654b9c8847942e75574c52d1652411e321b80b1861f93c163792636d1246bea9edc99c249
@UdjinM6 UdjinM6 modified the milestones: 24, 23.1.7 Jun 30, 2026
PastaPastaPasta added a commit that referenced this pull request Jul 1, 2026
2dd6190 fix: keep DKG session header self-contained (PastaClaw)
01fc719 chore: prepare v23.1.7 release (pasta)
c4eafd2 Merge #7393: fix: compilation error with modern gcc for leveldb subtree (pasta)
1cdc55a Merge #7392: backport: bitcoin#30633 (pasta)
cb6afcb net: avoid ThreadSocketHandler busy-loop on receive-paused peers (pasta)
b6e881a governance: bound govsync bloom filter hash-function count (pasta)
0a681db instantsend: cap islock inputs and bound the pending-lock queues (pasta)
1132a25 bls: guard AsyncVerifyContributionShare against a null verification vector (pasta)
31142da llmq: harden DKG message-intake against unauthenticated retention and crashes (pasta)

Pull request description:

  # chore: merge master into develop

  ## Issue being fixed or feature implemented

  Merge the v23.1.7 release branch history from `master` back into `develop`
  after the release.

  ## What was done?

  - Merged `upstream/master` (`01fc719f90`, `chore: prepare v23.1.7
    release`) into `upstream/develop` (`547bf5eee2`).
  - Resolved merge conflicts in release metadata/manpages, DKG hardening,
    InstantSend queue bounding, and BLS test coverage.
  - Preserved the v23.1.7 release updates and the hardening/build-fix commits now
    present on `master`.
  - Applied review fixes for the merge result:
    - kept DKG peer-misbehavior reason strings required by the new functional
      test coverage;
    - removed the stale duplicate `CDKGPrematureCommitment::GetSignHash()`
      definition after `dkgmessages.h` introduced inline message helpers;
    - fixed the new BLS unit test to start its local worker with an explicit
      worker count;
    - relaxed DKG intake structural checks to enforce safe upper bounds while
      leaving exact reduced-quorum member counts to the DKG session.

  ## How Has This Been Tested?

  - `git diff --check HEAD^1..HEAD`
  - `rg '^(<<<<<<<|>>>>>>>)'`
  - `code-review dashpay/dash upstream/develop chore/merge-master-into-develop-20260701`

  No local compile was run because this worktree has no configured build directory.

  ## Breaking Changes

  None expected. This is a release merge-back from `master` to `develop`.

  ## Checklist

  - [x] I have performed a self-review of my own code
  - [x] I have commented my code, particularly in hard-to-understand areas
  - [x] I have added or updated relevant unit/integration/functional/e2e tests
  - [x] I have made corresponding changes to the documentation
  - [ ] I have assigned this pull request to a milestone _(for repository
        code-owners and collaborators only)_

ACKs for top commit:
  kwvg:
    utACK 2dd6190

Tree-SHA512: 8ad430edaf451a8f33d4047702092c0f181e5e50fec61052dae446aee89371f3a18f2db0a52b287e80bb4806da485213e91f7a13cc0849d4cbbecd4c43101f9d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants