aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2021-04-09 18:08:33 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2021-04-13 18:25:43 +0200
commit75e72f82c8645db0f8cf6954ce3beb18a00dee37 (patch)
treed5f9cc1a416b73f8131cf08fba98bbe773f974bf
parentd1ab4c40982ffcfadebf3155f498469aeb1355b0 (diff)
downloadsparse-75e72f82c8645db0f8cf6954ce3beb18a00dee37.tar.gz
scheck: allow multiple assertions
With the SMT solver used here, by default, once an expression is checked it's kinda consumed by the process and can't be reused anymore for another check. So, enable the incremental mode: it allows to call boolecter_sat() several times. Note: Another would be, of course, to just AND together all assertions and just check this but then we would lost the finer grained diagnostic in case of failure. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--scheck.c5
-rw-r--r--validation/scheck/ok.c4
2 files changed, 3 insertions, 6 deletions
diff --git a/scheck.c b/scheck.c
index c64e8651..efa5c1c3 100644
--- a/scheck.c
+++ b/scheck.c
@@ -252,6 +252,7 @@ static bool check_function(struct entrypoint *ep)
int rc = 0;
boolector_set_opt(btor, BTOR_OPT_MODEL_GEN, 1);
+ boolector_set_opt(btor, BTOR_OPT_INCREMENTAL, 1);
FOR_EACH_PTR(ep->bbs, bb) {
struct instruction *insn;
@@ -274,8 +275,8 @@ static bool check_function(struct entrypoint *ep)
ternop(btor, insn);
break;
case OP_CALL:
- rc = check_call(btor, insn);
- goto out;
+ rc &= check_call(btor, insn);
+ break;
case OP_RET:
goto out;
default:
diff --git a/validation/scheck/ok.c b/validation/scheck/ok.c
index 76c04c4f..f4a0daab 100644
--- a/validation/scheck/ok.c
+++ b/validation/scheck/ok.c
@@ -1,10 +1,6 @@
static void ok(int x)
{
__assert((~x) == (~0 - x)); // true but not simplified yet
-}
-
-static void also_ok(int x)
-{
__assert_eq(~x, ~0 - x);
}