New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Slicer support for Arrays/Structs #1617
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this is sound. You're using the unadorned symbol name as key into the map. The array symbol could be touched in other ways (e.g. by non-constant index), in which case this change would overwrite that, wouldn't it?
Hm, depends. Right now the pre-requisite is that the index operation in the assertion contains a constant for the index. Similarly, for the WITH operation that its going to be replaced, it needs to be a constant index. Which means that
The main limitation is... if we have an assert that mix! I guess having a list of array that depends on a symbol should suffice. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rafaelsamenezes: can you please add some regression tests with the corner cases discussed in this issue?
@Anthonysdu: can you please evaluate this PR over the RMM project? |
@rafaelsamenezes: we could also move forward with this PR: #1398. @Anthonysdu started working on it, but there was not much progress for some reason. |
#1556 is also related to this PR. |
Hm, I think that the main issue is that this could increase the Symex time by a lot (since we need to compute huge arrays every time). This is fine for reasonably sized arrays, but computing an array of 50k positions everytime might be not worth (specially when just one index is needed). The slicer right now is trying to take advantage as a "lazy-evaluation". That being said, it would be great to do the WITH propagation on the sliced SSA! |
20eb9b5
to
65121c6
Compare
65121c6
to
0dd760a
Compare
This PR intends to expand our slicer to work with fields and structs by replacing the WITH operations with just the plain symbol. SMT solvers have big trouble dealing with all the updates. For example, the following program:
Will generate:
The increasing number of WITH takes progressively larger solving time. The slicer could replace the with id operations:
For the program above, changing the N resulted in the following Runtime decision procedure times with Z3 v4.12.4:
The implementation still requires a bit of testing, specially when an assertion depends on a symbolic index. Also, it would be great if we had some way of recursively replacing the equivalences. I think this could be done in another pass though.