-
Notifications
You must be signed in to change notification settings - Fork 273
What are the semantics of (repeated) declaration and DEAD for a single symbol? #8258
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
Comments
As a further example (and in an attempt to see what answers to the above questions would actually work out), consider the following program: __CPROVER_bool nondet_bool();
int main()
{
int *p = (int *)0;
while(nondet_bool())
{
int x;
if(p != 0)
*p = 1; // should be disallowed
p = &x;
*p = 42; // should be permitted
if(nondet_bool())
break;
}
if(p != 0)
{
int t = *p; // should be disallowed
}
} With this example, I do believe it is necessary to create fresh objects (for symbolic execution: fresh indices alone would not suffice) for each loop iteration. |
My mental model of the execution of a GOTO program is that there is an environment map of variable names -> value.
The most liberal interpretation is to return non-det / top on read for any missing values and ignore writes to dead things. However this might be too generous and it might be better to give an error. To use this informal semantics to try to answer your questions...
No, it adds it to the environment, making it valid to reference it.
Awkward. Ideally I would want
No, it means that it is no longer valid to even speak its name!
Again, I would want this to be independent of the semantics, if possible.
I think it shouldn't happen. It can be safely ignored if the implementation is preferring robustness. Maybe we really do need to do the long-proposed formalisation of the GOTO language... |
Consider the GOTO program produced from the following C input (this is about GOTO program semantics, not butchering C semantics), which fails to verify for any unwinding value greater or equal to 2:
Running CBMC yields:
While this verification result is consistent for C programs, it should be possible to create a GOTO program in some different way such that
main::1::1::1::x
is not marked "DEAD" when executingbreak
: GOTO programs don't have a concept of code blocks restricting scope other than as mandated by declarations and DEAD statements. With such a change, the verification failure still persists, but is now surprising for the GOTO program (as shown below for reference, minus instruction 17) will not have killedmain::1::1::1::x
when assigning toescaped
. (The reason is that goto-symex does not make any attempt to merge L1 instances of the same symbol at phi nodes.) Before trying to hack a fix into goto-symex, I'd like to seek consensus on the following questions:__CPROVER_dead_object
, or does this need to be left to an explicit GOTO program instruction?__CPROVER_dead_object
, or should that be done via a GOTO program statement?GOTO program for reference:
The text was updated successfully, but these errors were encountered: