Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Not_found exception in autotuner with congruences and termination. #1271

Merged
merged 3 commits into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/autoTune.ml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ let rec setCongruenceRecursive fd depth neigbourFunction =
FunctionSet.iter
(fun vinfo ->
print_endline (" " ^ vinfo.vname);
setCongruenceRecursive (Cilfacade.find_varinfo_fundec vinfo) (depth -1) neigbourFunction
match Cilfacade.find_varinfo_fundec vinfo with
| fd -> setCongruenceRecursive fd (depth -1) neigbourFunction
| exception Not_found -> () (* Happens for __goblint_bounded *)
)
(FunctionSet.filter (*for extern and builtin functions there is no function definition in CIL*)
(fun x -> not (isExtern x.vstorage || BatString.starts_with x.vname "__builtin"))
Expand Down
14 changes: 14 additions & 0 deletions tests/regression/78-termination/51-modulo.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// SKIP TERM PARAM: --enable ana.autotune.enabled --enable ana.sv-comp.functions --enable ana.sv-comp.enabled --set ana.autotune.activated "['congruence']" --set ana.specification "CHECK( init(main()), LTL(F end) )"

// This task previously crashed due to the autotuner
int main() {
int a;
int odd, count = 0;
while(a > 1) {
odd = a % 2;
if(!odd) a = a / 2;
else a = a - 1;
count++;
}
return count;
}