Skip to content

Commit 0a85a53

Browse files
authored
Merge pull request #1604 from goblint/issue-1181
Consider all spawning functions in autotuner
2 parents cdfb4a2 + b00c608 commit 0a85a53

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

src/autoTune.ml

+7-5
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ let hasFunction pred =
157157
Goblint_backtrace.wrap_val ~mark:(Cilfacade.FunVarinfo var) @@ fun () ->
158158
if LibraryFunctions.is_special var then
159159
let desc = LibraryFunctions.find var in
160-
GobOption.exists (fun args -> pred (desc.special args)) (functionArgs var)
160+
GobOption.exists (fun args -> pred desc args) (functionArgs var)
161161
else
162162
false
163163
in
@@ -169,7 +169,7 @@ let hasFunction pred =
169169
match unrollType var.vtype with
170170
| TFun (_, args, _, _) ->
171171
let args = BatOption.map_default (List.map (fun (x,_,_) -> MyCFG.unknown_exp)) [] args in
172-
pred (desc.special args)
172+
pred desc args
173173
| _ -> false
174174
else
175175
false
@@ -191,9 +191,10 @@ let enableAnalyses anas =
191191

192192
let notNeccessaryThreadAnalyses = ["race"; "deadlock"; "maylocks"; "symb_locks"; "thread"; "threadid"; "threadJoins"; "threadreturn"; "mhp"; "region"; "pthreadMutexType"]
193193
let reduceThreadAnalyses () =
194-
let isThreadCreate = function
194+
let isThreadCreate (desc: LibraryDesc.t) args =
195+
match desc.special args with
195196
| LibraryDesc.ThreadCreate _ -> true
196-
| _ -> false
197+
| _ -> LibraryDesc.Accesses.find_kind desc.accs Spawn args <> []
197198
in
198199
let hasThreadCreate = hasFunction isThreadCreate in
199200
if not @@ hasThreadCreate then (
@@ -446,7 +447,8 @@ let wideningOption factors file =
446447
}
447448

448449
let activateTmpSpecialAnalysis () =
449-
let isMathFun = function
450+
let isMathFun (desc: LibraryDesc.t) args =
451+
match desc.special args with
450452
| LibraryDesc.Math _ -> true
451453
| _ -> false
452454
in

src/util/autoSoundConfig.ml

+4-3
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ let enableSpecAnalyses spec analyses =
1212
Logs.info "Specification: %s -> enabling soundness analyses \"%s\"" (Svcomp.Specification.to_string [spec]) (String.concat ", " analyses);
1313
enableAnalyses analyses
1414

15-
let enableOptions options =
16-
let enableOpt option =
15+
let enableOptions options =
16+
let enableOpt option =
1717
Logs.info "Setting \"%s\" to true" option;
1818
set_bool option true
1919
in
@@ -60,7 +60,8 @@ let enableAnalysesForSpecification () =
6060
let longjmpAnalyses = ["activeLongjmp"; "activeSetjmp"; "taintPartialContexts"; "modifiedSinceSetjmp"; "poisonVariables"; "expsplit"; "vla"]
6161

6262
let activateLongjmpAnalysesWhenRequired () =
63-
let isLongjmp = function
63+
let isLongjmp (desc: LibraryDesc.t) args =
64+
match desc.special args with
6465
| LibraryDesc.Longjmp _ -> true
6566
| _ -> false
6667
in

0 commit comments

Comments
 (0)