Skip to content

SMT2: tolerate non-constant array indices when parsing array models#9063

Open
tautschnig wants to merge 1 commit into
developfrom
strata/smt2-array-model-nonconst-index
Open

SMT2: tolerate non-constant array indices when parsing array models#9063
tautschnig wants to merge 1 commit into
developfrom
strata/smt2-array-model-nonconst-index

Conversation

@tautschnig

Copy link
Copy Markdown
Collaborator

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.

  • Each commit message has a non-empty body, explaining why the change was made.
  • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • White-space or formatting changes outside the feature-related changed lines are in commits of their own.

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.

Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
@tautschnig tautschnig self-assigned this Jun 18, 2026
Copilot AI review requested due to automatic review settings June 18, 2026 20:01

Copilot AI 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.

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 store indices during walk_array_tree and skip processing those stores
  • Prevent to_constant_expr precondition violations caused by solver-returned models containing symbolic indices

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +640 to +643
if(!index_expr.is_constant())
// Non-constant index (e.g. an unbounded / non-integer-keyed heap array
// from Strata's `Map Ref _`): skip this store in model reconstruction.
return;
Comment on lines +640 to +643
if(!index_expr.is_constant())
// Non-constant index (e.g. an unbounded / non-integer-keyed heap array
// from Strata's `Map Ref _`): skip this store in model reconstruction.
return;
@codecov

codecov Bot commented Jun 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.68%. Comparing base (321ba11) to head (4cb733b).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #9063   +/-   ##
========================================
  Coverage    80.68%   80.68%           
========================================
  Files         1714     1714           
  Lines       189501   189502    +1     
  Branches        73       73           
========================================
+ Hits        152902   152905    +3     
+ Misses       36599    36597    -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants