-
Notifications
You must be signed in to change notification settings - Fork 265
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
goto-symex: assumed pointer equalities must update value set
Value sets and constant propagation are our only sources of points-to information when resolving dereferences in goto-symex. Therefore, assuming or branching on equalities of pointer-typed variables must have us consider both of their value sets to be equal. Else we may end up with spurious counterexamples as seen with the enclosed regression test (where we previously did not have any known value for `a`). Fixes: #8492
- Loading branch information
1 parent
018c61c
commit 2a27074
Showing
3 changed files
with
54 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
int main() | ||
{ | ||
int *r; | ||
int *a; | ||
#if 1 | ||
_Bool tmp_if_expr; | ||
if(r == 0) | ||
{ | ||
tmp_if_expr = 0; | ||
} | ||
else | ||
{ | ||
r = __CPROVER_allocate(sizeof(int), 0); | ||
tmp_if_expr = 1; | ||
} | ||
|
||
__CPROVER_assume(tmp_if_expr); | ||
#else | ||
// this works, because we constant-propagate r as an address-of expression | ||
__CPROVER_assume(r != 0); | ||
r = __CPROVER_allocate(sizeof(int), 0); | ||
#endif | ||
__CPROVER_assume(r != 0); | ||
__CPROVER_assume(r == a); | ||
__CPROVER_assert(r == a, " r == a before"); | ||
__CPROVER_assert(*r == *a, "*r == *a before"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
CORE | ||
main.c | ||
|
||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^VERIFICATION SUCCESSFUL$ | ||
-- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters