Repository navigation
Conversation
Consider a pointer that may point to an array as a whole, or to one of
its elements:
uint8_t raw[16] = {0};
raw[12] = 0xAA;
const void *p = c ? (const void *)(raw + 12) : (const void *)&raw;
assert(*(const uint8_t *)p == (c ? 0xAA : 0));
The value set of p then has two entries for the same object raw: one at
offset 12 (from raw + 12) and one at offset 0 (from &raw). Dereferencing
p builds a case split over these entries, where each case is guarded by
a condition that the pointer refers to that entry. For an entry at
offset 0 that guard is p == &raw, but for an entry at any other offset
it was only same_object(p, &raw), which is also true when p == &raw.
The value for the offset-12 entry, raw[12], is built for that constant
offset, though, so the case split read raw[12] for p == &raw, and the
assertion failed for c == 0.
When the offset of the entry is constant, also require the offset of the
pointer to match it. Entries with a non-constant offset keep using just
same_object, as their value is built from the pointer's actual offset.
melver
requested review from
kroening,
martin-cs,
peterschrammel and
tautschnig
as code owners
November 3, 2026 12:27
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #9388 +/- ##
===========================================
- Coverage 80.91% 80.91% -0.01%
===========================================
Files 1719 1719
Lines 190344 190350 +6
Branches 73 73
===========================================
+ Hits 154022 154025 +3
- Misses 36322 36325 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
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.
Consider a pointer that may point to an array as a whole, or to one of its elements:
The value set of p then has two entries for the same object raw: one at offset 12 (from raw + 12) and one at offset 0 (from &raw). Dereferencing p builds a case split over these entries, where each case is guarded by a condition that the pointer refers to that entry. For an entry at offset 0 that guard is p == &raw, but for an entry at any other offset it was only same_object(p, &raw), which is also true when p == &raw. The value for the offset-12 entry, raw[12], is built for that constant offset, though, so the case split read raw[12] for p == &raw, and the assertion failed for c == 0.
When the offset of the entry is constant, also require the offset of the pointer to match it. Entries with a non-constant offset keep using just same_object, as their value is built from the pointer's actual offset.
Assisted-by: Antigravity
The feature or user visible behaviour I have added or modified has been documented in the User Guide in(bug fix only)doc/cprover-manual/
which ones those are in the commit message).
My commit message includes data points confirming performance improvements (if claimed).(no performance claims)