Skip to content

Commit

Permalink
add regression tests for missing old var equality precondition
Browse files Browse the repository at this point in the history
  • Loading branch information
maul-esel committed Dec 18, 2024
1 parent 9941e7e commit 73787b7
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
22 changes: 22 additions & 0 deletions trunk/examples/programs/regression/bpl/RequiresOldVarEquality.bpl
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 trunk/examples/programs/regression/c/RequiresOldVarEquality.c
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++;
}
}
}

0 comments on commit 73787b7

Please sign in to comment.