Repository navigation
Fix GCC 11 -Wmaybe-uninitialized false positive in document_stream_tests - #2875
Merged
Merged
Conversation
…-Wmaybe-uninitialized GCC 11.4 (Ubuntu 22.04 CI, Debug/-Og developer build with -Werror) reports a false-positive 'v may be used uninitialized' on the json_sequence subtest since #2870 landed on top of #2872. The variable is only read after get(v) returned SUCCESS, so this is purely a diagnostic issue; the warning flips on unrelated call-graph changes in headers pulled in via simdjson.h. Initialize all the int64_t v locals in the file so the other identical sites cannot start failing the same way later.
lemire
force-pushed
the
fix-gcc11-maybe-uninitialized
branch
from
September 22, 2026 02:23
6c85544 to
7cf1861
Compare
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Master is currently red on Ubuntu 22.04 CI (GCC 11) since #2870 was merged:
This is a GCC 11.4 false positive in the Debug (
-Og -Werror) developer build:vis only read afterdoc["i"].get(v)returnedSUCCESS, which always writes it. Neither #2870 nor #2872 triggers it on its own; it only shows up with both sets of header changes in the translation unit (they reachdocument_stream_tests.cppviasimdjson.h), and it goes away with-fno-ipa-pure-const, so it is GCC's IPA analysis flipping on unrelated call-graph changes rather than anything wrong in either PR.Fix: initialize every
int64_t v;local intests/dom/document_stream_tests.cpp(17 sites). Only line 1583 fails today, but the others are the same pattern and could start failing on the next unrelated header change.Verified in an amd64 Ubuntu 22.04 container with GCC 11.4.0 using the CI's Debug developer-mode configuration: master fails, this branch builds cleanly and
document_stream_testspasses.