linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: linux-sparse@vger.kernel.org
Cc: Ramsay Jones <ramsay@ramsayjones.plus.com>,
	Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: [PATCH v2 6/8] scheck: allow multiple assertions
Date: Mon, 12 Apr 2021 23:21:09 +0200	[thread overview]
Message-ID: <20210412212111.29186-7-luc.vanoostenryck@gmail.com> (raw)
In-Reply-To: <20210412212111.29186-1-luc.vanoostenryck@gmail.com>

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>
---
 scheck.c               | 5 +++--
 validation/scheck/ok.c | 4 ----
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/scheck.c b/scheck.c
index c64e865136c5..efa5c1c3247b 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 76c04c4f6870..f4a0daabfe9a 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);
 }
 
-- 
2.31.1


  parent reply	other threads:[~2021-04-12 21:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-12 21:21 [PATCH v2 0/8] scheck: add a symbolic checker Luc Van Oostenryck
2021-04-12 21:21 ` [PATCH v2 1/8] export declare_builtins() Luc Van Oostenryck
2021-04-12 21:21 ` [PATCH v2 2/8] builtin: define a symbol_op for a generic op acting on integer Luc Van Oostenryck
2021-04-13  0:23   ` Ramsay Jones
2021-04-13 16:42     ` Luc Van Oostenryck
2021-04-12 21:21 ` [PATCH v2 3/8] .gitignore is a bit too greedy Luc Van Oostenryck
2021-04-12 21:21 ` [PATCH v2 4/8] scheck: add a symbolic checker Luc Van Oostenryck
2021-04-12 21:21 ` [PATCH v2 5/8] scheck: assert_eq() Luc Van Oostenryck
2021-04-12 21:21 ` Luc Van Oostenryck [this message]
2021-04-12 21:21 ` [PATCH v2 7/8] scheck: assert_const() Luc Van Oostenryck
2021-04-12 21:21 ` [PATCH v2 8/8] scheck: support pre-conditions via __assume() Luc Van Oostenryck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210412212111.29186-7-luc.vanoostenryck@gmail.com \
    --to=luc.vanoostenryck@gmail.com \
    --cc=linux-sparse@vger.kernel.org \
    --cc=ramsay@ramsayjones.plus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).