SMT2: tolerate non-constant array indices when parsing array models#9063
Open
tautschnig wants to merge 1 commit into
Open
SMT2: tolerate non-constant array indices when parsing array models#9063tautschnig wants to merge 1 commit into
tautschnig wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates SMT2 array model parsing to avoid aborting when encountering store terms with non-constant indices, instead skipping those entries during model reconstruction.
Changes:
- Detect non-constant
storeindices duringwalk_array_treeand skip processing those stores - Prevent
to_constant_exprprecondition violations caused by solver-returned models containing symbolic indices
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #9063 +/- ##
========================================
Coverage 80.68% 80.69%
========================================
Files 1714 1714
Lines 189593 189625 +32
Branches 73 73
========================================
+ Hits 152979 153018 +39
+ Misses 36614 36607 -7 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
smt2_convt::walk_array_tree assumes every (store array index value) term in a solver-returned array model has a constant index, calling to_constant_expr on it unconditionally. Models for unbounded or non-integer-keyed arrays can contain a non-constant index, which trips the to_constant_expr precondition. Skip such store entries during model reconstruction instead of aborting. Add a unit test that drives walk_array_tree directly (via a subclass exposing the protected method) with a store term whose index is a plain symbol, and asserts that reconstruction does not abort and drops only the offending entry while keeping the well-formed default. The test puts invariants into throwing mode (cbmc_invariants_should_throwt) so that, without the guard, the to_constant_expr precondition surfaces as a clean test failure rather than aborting the unit binary. Note on test shape: parse_rec dispatches on the index type (the array's size type) and coerces arithmetic types to constants, so a non-constant index can only be produced by a non-arithmetic index type (which parses to a nil expression). Such a type is not integer-convertible, so a surviving constant-integer-indexed store cannot coexist with a dropped non-constant one in the same model at the irept level; the preserved well-formed entry in the test is therefore the (as const ...) default, which is collected without going through index parsing. Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
4cb733b to
69cf780
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.
smt2_convt::walk_array_tree assumes every (store array index value) term in a solver-returned array model has a constant index, calling to_constant_expr on it unconditionally. Models for unbounded or non-integer-keyed arrays can contain a non-constant index, which trips the to_constant_expr precondition. Skip such store entries during model reconstruction instead of aborting.