-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add regression tests for missing old var equality precondition
- Loading branch information
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
trunk/examples/programs/regression/bpl/RequiresOldVarEquality.bpl
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,22 @@ | ||
//#Safe | ||
/* | ||
* To prove this program correct, Ultimate needs to consider the implicit precondition that g == old(g). | ||
* As of 2024-12-18, this precondition was not considered in library mode, and thus Automizer wrongly claimed that this program is incorrect. | ||
* | ||
* This is a Boogie version of ../c/RequiresOldVarEquality.c to make sure that the problem is fixed for both C and Boogie programs. | ||
*/ | ||
|
||
var g : int; | ||
|
||
procedure increment() | ||
requires g < 1048; | ||
ensures g > old(g); | ||
modifies g; | ||
{ | ||
g := g + 1; | ||
while (*) | ||
invariant (g > old(g)); | ||
{ | ||
g := g + 1; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
trunk/examples/programs/regression/c/RequiresOldVarEquality.c
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,22 @@ | ||
//#Safe | ||
/* | ||
* To prove this program correct, Ultimate needs to consider the implicit precondition that g == old(g). | ||
* As of 2024-12-18, this precondition was not considered in library mode, and thus Automizer wrongly claimed that this program is incorrect. | ||
*/ | ||
|
||
extern void reach_error(void); | ||
extern char __VERIFIER_nondet_char(); | ||
|
||
int g; | ||
|
||
//@ requires g < 1048; | ||
//@ ensures (g > \old(g)); | ||
void increment() { | ||
g++; | ||
//@ loop invariant g > \old(g); | ||
while(__VERIFIER_nondet_char()) { | ||
if (g < 2147483647) { | ||
g++; | ||
} | ||
} | ||
} |