Skip to content

Commit

Permalink
fix crash with fn calls with read-only memory attr
Browse files Browse the repository at this point in the history
  • Loading branch information
nunoplopes committed Oct 7, 2024
1 parent 05f674c commit 583b733
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions ir/memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1853,7 +1853,8 @@ void Memory::setState(const Memory::CallState &st,
if (!only_write_inaccess.isTrue()) {
unsigned idx = 1;
unsigned limit = num_nonlocals_src - num_inaccessiblememonly_fns;
for (unsigned bid = 0; bid < limit; ++bid) {
const auto written_blocks = st.non_local_block_val.size();
for (unsigned bid = 0; bid < limit && idx < written_blocks; ++bid) {
if (always_nowrite(bid, true, true))
continue;

Expand Down Expand Up @@ -1884,7 +1885,7 @@ void Memory::setState(const Memory::CallState &st,
if (modifies.isTrue())
non_local_block_val[bid].undef.clear();
}
assert(idx == st.non_local_block_val.size());
assert(written_blocks == 0 || idx == written_blocks);
}

if (!st.non_local_liveness.isAllOnes()) {
Expand Down
2 changes: 1 addition & 1 deletion ir/state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ expr SMTMemoryAccess::canWriteSomething() const {
}

expr SMTMemoryAccess::refinedBy(const SMTMemoryAccess &other) const {
return val == other.val;
return (val & other.val) == val;
}

SMTMemoryAccess
Expand Down

0 comments on commit 583b733

Please sign in to comment.