-
Notifications
You must be signed in to change notification settings - Fork 76
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
Fully simplifying assertions with base sometimes harmful for precision of relational analyses #1650
Comments
I don't think that's exactly what's happening. In parsing I think what might be happening is that relational analyses themselves do some Can lin2vareq express constant propagation (e.g. |
The apron analyses share the functionality of converting cil expressions to apron expressions via the sharedFunctions module, currently. During this processing of expressions, this simplification process is implicitly performed, without the actual domain/analyses even noticing that this has happened.
All apron domains can indeed represent constant propagation. The precision tweak that was behind this whole simplification thing was a little more complicated. On the one hand, there are the weakly relational domains that can profit enormously from these kinds of simplifications, to have a chance of interpreting certain guards at all. On the other hand, even though the equality based domains like affeq or lin2vareq can represent constants, they in practice do miss constants that are inferred by means of inequality guards. These two aspects have led us to pull the evalint simplification into the expression conversion part. The purpose of this issue here is to document and create awareness of the downside of this implementation choice. What I have wondered is, whether as soon as algebraic effects are available, we could let evalint communicate back via effect what the outcome of the greatest lower bound of the query is, in order to refine the other domains.... |
Currently, when translating CIL expression -> Apron expression for guards, we fully simplify all appearing expressions, which is usually beneficial.
Thus, if base knows something will hold it gets simplified to
1
. However, this can have adverse effects when a relational domain is not as precise as the base domain, as the information from the guard is not added to the relational domain, even if is expressible.After a control-flow join, base may no longer be able to show the invariant even if it could in both branches. If the information was added to the relational domain, it would survive.
Consider, e.g., the following example with intervals and
lin2vareq
:In both branches,
a
andb
are constant andb == a+2
holds which is checked by__goblint_check
. However, as the constant value fora
andb
is established by a sequence of inequalities, this information is not available in the equality-basedlin2vareq
. Then, a guard assertingb == a+2
is executed. Normally, this would cause2vareq
to pick up on the equality, but we simplify it to1
before passing it to the domain. Thus the value in2vareq
remainsT
.After join, base can no longer establish
b == a+2
. As it was not added to2vareq
either, it cannot be shown.There seem to be various things that could be done here:
@DrMichaelPetter, @jerhard and I jointly came across this while talking about #1610.
The text was updated successfully, but these errors were encountered: