goto-symex: support struct-keyed arrays (maps) in value materialisation#9065
goto-symex: support struct-keyed arrays (maps) in value materialisation#9065tautschnig 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.
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::assignarray 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.
| 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()); |
| 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; | ||
| } |
| 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>
d718733 to
abda365
Compare
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
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).