Skip to content

Commit f0ad808

Browse files
committed
Add positive test for fix of implication statement antecedent guard refinement.
Before this change the division-by-zero check would fail because the antecedent part of the implication statement wouldn't be used to refine the guard of any checks performed in the consequent part of the statement.
1 parent 17422ea commit f0ad808

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// clang-format off
2+
int main(int argc, char **argv)
3+
{
4+
int y;
5+
6+
__CPROVER_assert(
7+
y != 0 ==> 10 / y <= 10,
8+
"10 / y is expected to succeed");
9+
}
10+
// clang-format on
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
CORE
2+
--div-by-zero-check
3+
test.c
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
\[main\.assertion\.1\] line \d 10 / y is expected to succeed: SUCCESS
7+
\[main\.division-by-zero\.1\] line \d division by zero in 10 / y: SUCCESS
8+
^VERIFICATION SUCCESSFUL$
9+
--
10+
\[main\.division-by-zero\.1\] line \d division by zero in 10 / y: FAILURE
11+
--
12+
Without the change that drives the refinement of the guard for a `ID_implies`
13+
statement in `goto-check`, this will fail with a counterexample of `y = 0`.
14+
With the bug fix, the `--div-by-zero-check` will succeed because the
15+
antecedent of the conditional is becoming the guard for the consequent,
16+
guarding any checks performed there.

0 commit comments

Comments
 (0)