-
Notifications
You must be signed in to change notification settings - Fork 46
Use call as location for error node corresponding to requires #730
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
base: dev
Are you sure you want to change the base?
Conversation
This reverts commit bb54f4c for RCFGBuilder and applies the same patch for IcfgBuilder.
What happens if a function with a requires is called from multiple locations, i.e., a function with more than one call? |
For each call different error nodes are already constructed, this was not changed in this PR, they just have the "wrong" location at the declaration of the function to be called. You can see it in this log from the SV-COMP for memsafety:
There are multiple pointer dereferences in the C program and you can see from the counterexample that we found that the dereference in line 584 might fail, but any result ( |
I was thinking about the case where a program has an ACSL requires and a call violates that. How is this error reported now? |
Okay, consider this program //@ requires x >= 0;
int f(int x) {
return x - 1;
}
int main() {
f(0);
f(-1);
} Currently, there are two results:
for Both of these results contain the line 1 of the requires, with this PR the locations of the results would change to line 7 and 8. |
Ok, is this the current state? What would it look like with this PR? I would think we want to have both, the requires and the call, and if the requires does not have a valid line then we drop it. And the second result looks strange anyways: why is there Call, Requires, Return, Requires? I would expect Call, Requires, Return, Call, Requires. Why is the second call different? |
So far, this PR only changes the location of the error nodes that are only used in the result.
We get a counterexample for the second call, even though the call
🤷♂️ |
:) I thought we had a NotCheckedResult or something like that, |
Currently, the error nodes in the CFG that correspond to a
requires
use the location of the requires itself instead of the call (this behaviour was changed in bb54f4c). Therefore, the results whether arequires
for a call holds (as produced by e.g., trace abstraction) also contain the location (as a line number) of the function declaration. This behaviour is particullarly problematic when checking for memsafety of C programs. There, we add a requires to an auxiliary read function (that has the line number -1 for that reason) and therefore we get results like this:CounterExampleResult [Line: -1]: pointer dereference may fail
.This PR changes the behaviour again, such that the location of the call is used to identify the error location from a requires. To do so, the method
CfgBuilder::addErrorNode
receives theBoogieASTNode
for the location and the specification to label the error node separately.The change was applied to
RCFGBuilder
andIcfgBuilder
.