Skip to content

goto-symex: support struct-keyed arrays (maps) in value materialisation#9065

Open
tautschnig wants to merge 1 commit into
developfrom
strata/symex-struct-keyed-maps
Open

goto-symex: support struct-keyed arrays (maps) in value materialisation#9065
tautschnig wants to merge 1 commit into
developfrom
strata/symex-struct-keyed-maps

Conversation

@tautschnig

Copy link
Copy Markdown
Collaborator

Field-sensitivity and the value-set assume array indices are integer-typed. For arrays keyed by a struct (used to model heaps as Map Ref Struct), the from_integer-based index construction aborts. Gate is_divisible/get_fields to integer/bitvector/enum index types, and relax value_sett::assign array type-equality to allow arrays with the same element type but differing size (unbounded heap maps).

  • 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.

@tautschnig tautschnig self-assigned this Jun 18, 2026
Copilot AI review requested due to automatic review settings June 18, 2026 20:07

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.

This PR updates goto-symex field sensitivity and pointer-analysis value materialisation to support “map-like” arrays keyed by non-integer types (e.g., struct references), avoiding invalid integer-index enumeration and relaxing array type matching to ignore size differences.

Changes:

  • Treat arrays with non-scalar index types monolithically (skip element enumeration / field decomposition).
  • Relax value_sett::assign array type invariant to allow differing array sizes when element types match.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/pointer-analysis/value_set.cpp Allows assigning arrays with same element type but different sizes (for unbounded heap-map models).
src/goto-symex/field_sensitivity.cpp Prevents field-splitting / enumeration for arrays whose index types can’t be constructed via from_integer.

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

Comment on lines +1596 to 1602
rhs.type() == lhs.type() ||
(rhs.type().id() == ID_array && lhs.type().id() == ID_array &&
to_array_type(rhs.type()).element_type() ==
to_array_type(lhs.type()).element_type()),
"value_sett::assign types should match (modulo array size), got: "
"rhs.type():\n" +
rhs.type().pretty() + "\n" + "type:\n" + lhs.type().pretty());
Comment on lines +358 to +366
const typet &idx_t = type.index_type();
if(
idx_t.id() != ID_unsignedbv && idx_t.id() != ID_signedbv &&
idx_t.id() != ID_bv && idx_t.id() != ID_integer &&
idx_t.id() != ID_c_enum && idx_t.id() != ID_c_enum_tag &&
idx_t.id() != ID_c_bool && idx_t.id() != ID_bool)
{
return ssa_expr;
}
Comment on lines +651 to +658
if(
idx_t.id() == ID_unsignedbv || idx_t.id() == ID_signedbv ||
idx_t.id() == ID_bv || idx_t.id() == ID_integer ||
idx_t.id() == ID_c_enum || idx_t.id() == ID_c_enum_tag ||
idx_t.id() == ID_c_bool || idx_t.id() == ID_bool)
{
return true;
}
Field-sensitivity and the value-set assume array indices are integer-typed.
For arrays keyed by a struct (used to model heaps as Map Ref Struct), the
from_integer-based index construction aborts. Gate is_divisible/get_fields
to integer/bitvector/enum index types, and relax value_sett::assign array
type-equality to allow arrays with the same element type but differing size
(unbounded heap maps).

Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
@codecov

codecov Bot commented Jun 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 64.28571% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.68%. Comparing base (321ba11) to head (abda365).

Files with missing lines Patch % Lines
src/goto-symex/field_sensitivity.cpp 64.28% 5 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #9065      +/-   ##
===========================================
- Coverage    80.68%   80.68%   -0.01%     
===========================================
  Files         1714     1714              
  Lines       189501   189515      +14     
  Branches        73       73              
===========================================
+ Hits        152902   152908       +6     
- Misses       36599    36607       +8     

☔ 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