Fix GCC 16 warning-as-error build failures#9024
Open
StudyingFather wants to merge 4 commits into
Open
Conversation
GCC 16 reports false-positive -Warray-bounds warnings through the ranget::map shared_ptr/std::function instantiations used with json_stringt values. Build the source-location pragma JSON array explicitly, and keep json_arrayt range-construction coverage by collecting an existing range of json_stringt values directly. This avoids the warning path without changing the JSON output or tested behaviour.
… dispatch GCC 16 can report false-positive -Warray-bounds warnings after devirtualising and inlining calls on base-class objects as if derived-class layouts were available. Call the known base implementations explicitly in the variable-sensitivity factory and the corresponding unit-test helper. The constructed dynamic types are unchanged, and the explicit calls avoid the over-eager diagnostic path.
GCC 16 warns when std::reference_wrapper<const namespacet> is instantiated while namespacet is still incomplete in struct_encoding.h. Use a plain reference member instead. struct_encodingt already binds to an external namespace for its lifetime, so this preserves behaviour while avoiding -Wsfinae-incomplete under -Werror.
The counter in smt2_convt::unflatten was incremented while converting datatype structs but was never read. Remove it, and keep the touched loop formatted, to avoid the GCC 16 -Wunused-but-set-variable warning under -Werror without changing the generated SMT2 output.
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.
This PR fixes GCC 16 build failures caused by warnings promoted to errors (fixes #9004).
The changes cover four warning categories:
-Warray-boundsfalse positives involvingranget::map,json_stringt, andstd::shared_ptr<std::function<...>>by using more direct JSON array construction in the affected paths.-Warray-boundsfalse positives where virtual-call inlining/devirtualization appears to reason about a base object using a derived object layout.-Wsfinae-incompleteby storingstruct_encodingt's namespace as a plain reference instead ofstd::reference_wrapper<const namespacet>whilenamespacetis still incomplete.-Wunused-but-set-variable.The intended behaviour is unchanged; these are either warning-path cleanups or removal of dead bookkeeping.