Skip to content

Commit

Permalink
Termination analysis: Insert only one increment statement, do not set…
Browse files Browse the repository at this point in the history
… assume no overflow.
  • Loading branch information
jerhard committed Nov 13, 2023
1 parent 7241324 commit 76751d4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
3 changes: 1 addition & 2 deletions src/maingoblint.ml
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,7 @@ let check_arguments () =
if List.mem "termination" @@ get_string_list "ana.activated" then (
if GobConfig.get_bool "incremental.load" || GobConfig.get_bool "incremental.save" then fail "termination analysis is not compatible with incremental analysis";
set_list "ana.activated" (GobConfig.get_list "ana.activated" @ [`String ("threadflag")]);
set_string "sem.int.signed_overflow" "assume_none";
warn "termination analysis implicitly activates threadflag analysis and set sem.int.signed_overflow to assume_none"
warn "termination analysis implicitly activates threadflag analysis."
);
if not (get_bool "ana.sv-comp.enabled") && get_bool "witness.graphml.enabled" then fail "witness.graphml.enabled: cannot generate GraphML witness without SV-COMP mode (ana.sv-comp.enabled)"

Expand Down
8 changes: 1 addition & 7 deletions src/util/terminationPreprocessing.ml
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,8 @@ class loopCounterVisitor lc (fd : fundec) = object(self)
let lval = Lval (Var v, NoOffset) in
let init_stmt = mkStmtOneInstr @@ Set (var v, min_int_exp, loc, eloc) in
let inc_stmt = mkStmtOneInstr @@ Set (var v, increment_expression lval, loc, eloc) in
let inc_stmt2 = mkStmtOneInstr @@ Set (var v, increment_expression lval, loc, eloc) in
let exit_stmt = mkStmtOneInstr @@ Call (None, f_bounded, [lval], loc, locUnknown) in
(match b.bstmts with
| s :: ss -> (*duplicate increment statement here to fix inconsistencies in nested loops*)
b.bstmts <- exit_stmt :: inc_stmt :: s :: inc_stmt2 :: ss;
| ss ->
b.bstmts <- exit_stmt :: inc_stmt :: ss;
);
b.bstmts <- exit_stmt :: inc_stmt :: b.bstmts;
lc := VarToStmt.add (v: varinfo) (s: stmt) !lc;
let nb = mkBlock [init_stmt; mkStmt s.skind] in
s.skind <- Block nb;
Expand Down

0 comments on commit 76751d4

Please sign in to comment.