SMT2: skip element enumeration for non-integer-keyed array literals#9062
Open
tautschnig wants to merge 1 commit into
Open
SMT2: skip element enumeration for non-integer-keyed array literals#9062tautschnig wants to merge 1 commit into
tautschnig wants to merge 1 commit into
Conversation
The array-constructor substitute in find_symbols enumerates element indices via from_integer(i, index_type), which is only valid for integer/bitvector index types. For arrays keyed by a non-scalar type, leave the array unconstrained (a sound over-approximation) rather than constructing an integer constant of a non-integer index type. Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adjusts SMT2 array-literal handling to avoid generating invalid index constants for arrays whose index type can’t be constructed from integers, by skipping per-element constraints in that case.
Changes:
- Adds an index-type guard so per-element array constraints are only emitted for integer/bitvector-like index types.
- Documents the rationale and treats non-integer-keyed arrays as unconstrained (sound over-approximation).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+5624
to
+5629
| const typet &idx_t = array_type.index_type(); | ||
| const bool int_index = | ||
| 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; |
Comment on lines
+5625
to
+5629
| const bool int_index = | ||
| 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; |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #9062 +/- ##
========================================
Coverage 80.68% 80.68%
========================================
Files 1714 1714
Lines 189501 189507 +6
Branches 73 73
========================================
+ Hits 152902 152913 +11
+ Misses 36599 36594 -5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
The array-constructor substitute in find_symbols enumerates element indices via from_integer(i, index_type), which is only valid for integer/bitvector index types. For arrays keyed by a non-scalar type, leave the array unconstrained (a sound over-approximation) rather than constructing an integer constant of a non-integer index type.