Repository navigation
Fix GCC 16 warning-as-error build failures - #9024
Conversation
|
With apologies for the late response: could you please rebase so that CI can run again? |
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.
The source-location pragma JSON test should check the emitted pragma set rather than the iteration order of irept::named_subt. Collect and sort the JSON string values before comparing them so the test remains stable across named_subt implementations and dstring interning order.
Move the testing-utils include after util includes in the JSON unit tests to match clang-format-15 include ordering.
80e2c18 to
6a3f2c2
Compare
done. |
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The targeted warning workarounds preserve existing semantics and include appropriate regression coverage.
Review effort: Balanced
Findings: None
What changed in this PR
Fixes GCC 16 warning-as-error failures without changing runtime behavior.
Changes:
- Reworks JSON array construction and adds pragma serialization coverage.
- Avoids false-positive warnings from virtual-call devirtualization.
- Replaces incomplete-type wrapping and removes unused bookkeeping.
| File | Description |
|---|---|
unit/util/json_object.cpp |
Tests source-location pragma serialization. |
unit/util/json_array.cpp |
Simplifies range-based array construction test. |
unit/analyses/variable-sensitivity/eval-member-access.cpp |
Avoids virtual dispatch in test setup. |
src/util/json_irep.cpp |
Constructs pragma arrays directly. |
src/solvers/smt2/smt2_conv.cpp |
Removes unused component counter. |
src/solvers/smt2_incremental/encoding/struct_encoding.h |
Stores namespace as a reference. |
src/solvers/smt2_incremental/encoding/struct_encoding.cpp |
Updates namespace access for the reference member. |
src/analyses/variable-sensitivity/variable_sensitivity_domain.h |
Qualifies the concrete is_bottom call. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #9024 +/- ##
===========================================
+ Coverage 80.85% 80.86% +0.01%
===========================================
Files 1717 1717
Lines 190153 190161 +8
Branches 73 73
===========================================
+ Hits 153754 153781 +27
+ Misses 36399 36380 -19 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
bd5c6fc to
83f4ae8
Compare
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.