-
Notifications
You must be signed in to change notification settings - Fork 282
Description
Hey all,
CBMC does not seem to handle values of "switch-local" variables correctly, i.e. variables that were defined in the local scope of a switch-statement. In this example, x
is such a variable:
extern void __VERIFIER_error();
void main() {
switch (0) {
int x;
default:
x = 0;
if (x) __VERIFIER_error();
}
}
CBMC returns VERIFICATION FAILED
when run on this program. Indeed, x
is of an indeterminate value at its declaration, but set to 0
directly afterwards in the default case. Hence, the error location should not be reachable and the program determined safe.
Upon inspection it seems like CBMC does not propagate the constraint of x=0
correctly and still assumes a non-deterministic value after its assignment - CBMC was able to produce a counterexample for x=262144
.
CBMC version: 5.10
Operating system: Linux
Exact command line resulting in the issue: cbmc bug.c
What behaviour did you expect: CBMC returns VERIFICATION SUCCESSFUL
What happened instead: CBMC returns VERIFICATION FAILED