@@ -206,29 +206,31 @@ let hasFunction pred =
206206 calls.calledBy |> FunctionCallMap. exists (fun var _ -> relevant_static var) ||
207207 calls.dynamicallyCalled |> FunctionSet. exists relevant_dynamic
208208
209- let disableAnalyses anas =
210- List. iter (GobConfig. set_auto " ana.activated[-]" ) anas
209+ let disableAnalyses reason analyses =
210+ Logs. info " %s -> disabling analyses: \" %s\" " reason (String. concat " , " analyses);
211+ List. iter (GobConfig. set_auto " ana.activated[-]" ) analyses
211212
212- let enableAnalyses anas =
213- List. iter (GobConfig. set_auto " ana.activated[+]" ) anas
213+ let enableAnalyses reason description analyses =
214+ Logs. info " %s -> enabling %s: \" %s\" " reason description (String. concat " , " analyses);
215+ List. iter (GobConfig. set_auto " ana.activated[+]" ) analyses
214216
215217(* If only one thread is used in the program, we can disable most thread analyses*)
216218(* The exceptions are analyses that are depended on by others: base -> mutex -> mutexEvents, access; termination -> threadflag *)
217219(* escape is also still enabled, because otherwise we get a warning*)
218220(* does not consider dynamic calls!*)
221+ let notNeccessaryRaceAnalyses = [" race" ; " symb_locks" ; " region" ]
222+ let notNeccessaryThreadAnalyses = notNeccessaryRaceAnalyses @ [" deadlock" ; " maylocks" ; " thread" ; " threadid" ; " threadJoins" ; " threadreturn" ; " mhp" ; " pthreadMutexType" ]
219223
220- let notNeccessaryThreadAnalyses = [" race" ; " deadlock" ; " maylocks" ; " symb_locks" ; " thread" ; " threadid" ; " threadJoins" ; " threadreturn" ; " mhp" ; " region" ; " pthreadMutexType" ]
221- let reduceThreadAnalyses () =
224+ let hasSpec spec = List. mem spec (Svcomp.Specification. of_option () )
225+
226+ let reduceAnalyses () =
222227 let isThreadCreate (desc : LibraryDesc.t ) args =
223228 match desc.special args with
224229 | LibraryDesc. ThreadCreate _ -> true
225230 | _ -> LibraryDesc.Accesses. find_kind desc.accs Spawn args <> []
226231 in
227232 let hasThreadCreate = hasFunction isThreadCreate in
228- if not @@ hasThreadCreate then (
229- Logs. info " no thread creation -> disabling thread analyses \" %s\" " (String. concat " , " notNeccessaryThreadAnalyses);
230- disableAnalyses notNeccessaryThreadAnalyses;
231- )
233+ if not hasThreadCreate then disableAnalyses " no thread creation" notNeccessaryThreadAnalyses
232234
233235let focusOnMemSafetySpecification (spec : Svcomp.Specification.t ) =
234236 match spec with
@@ -247,8 +249,7 @@ let focusOnTermination (spec: Svcomp.Specification.t) =
247249 match spec with
248250 | Termination ->
249251 let terminationAnas = [" threadflag" ; " apron" ] in
250- Logs. info " Specification: Termination -> enabling termination analyses \" %s\" " (String. concat " , " terminationAnas);
251- enableAnalyses terminationAnas;
252+ enableAnalyses " Specification: Termination" " termination analyses" terminationAnas;
252253 set_string " sem.int.signed_overflow" " assume_none" ;
253254 set_bool " ana.int.interval" true ;
254255 set_string " ana.apron.domain" " polyhedra" ; (* TODO: Needed? *)
@@ -258,16 +259,16 @@ let focusOnTermination (spec: Svcomp.Specification.t) =
258259let focusOnTermination () =
259260 List. iter focusOnTermination (Svcomp.Specification. of_option () )
260261
261- let concurrencySafety (spec : Svcomp.Specification.t ) =
262- match spec with
263- | NoDataRace -> (* enable all thread analyses*)
264- Logs. info " Specification: NoDataRace -> enabling thread analyses \" %s\" " (String. concat " , " notNeccessaryThreadAnalyses);
265- enableAnalyses notNeccessaryThreadAnalyses;
266- | _ -> ()
262+ let focusOnConcurrencySafety () =
263+ if hasSpec SvcompSpec. NoDataRace then
264+ (* enable all thread analyses*)
265+ (* TODO: what's the exact relation between thread analyses enabled in conf, the ones we disable in reduceAnalyses and the ones we enable here? *)
266+ enableAnalyses " Specification: NoDataRace" " thread analyses" notNeccessaryThreadAnalyses
267+ else
268+ disableAnalyses " NoDataRace property is not in spec" notNeccessaryRaceAnalyses
267269
268- let noOverflows (spec : Svcomp.Specification.t ) =
269- match spec with
270- | NoOverflow ->
270+ let focusOnNoOverflows () =
271+ if hasSpec SvcompSpec. NoOverflow then (
271272 (* We focus on integer analysis*)
272273 set_bool " ana.int.def_exc" true ;
273274 begin
@@ -276,10 +277,7 @@ let noOverflows (spec: Svcomp.Specification.t) =
276277 set_int " ana.malloc.unique_address_count" 1
277278 with Found -> set_int " ana.malloc.unique_address_count" 0 ;
278279 end
279- | _ -> ()
280-
281- let focusOn (f : SvcompSpec.t -> unit ) =
282- List. iter f (Svcomp.Specification. of_option () )
280+ )
283281
284282(* Detect enumerations and enable the "ana.int.enums" option*)
285283exception EnumFound
@@ -492,8 +490,7 @@ let activateTmpSpecialAnalysis () =
492490 in
493491 let hasMathFunctions = hasFunction isMathFun in
494492 if hasMathFunctions then (
495- Logs. info " math function -> enabling tmpSpecial analysis and floating-point domain" ;
496- enableAnalyses [" tmpSpecial" ];
493+ enableAnalyses " Math function" " tmpSpecial analysis and floating-point domain" [" tmpSpecial" ];
497494 set_bool " ana.float.interval" true ;
498495 )
499496
@@ -546,15 +543,17 @@ let chooseConfig file =
546543 if isActivated " mallocWrappers" then
547544 findMallocWrappers () ;
548545
549- if isActivated " concurrencySafetySpecification" then focusOn concurrencySafety;
546+ if isActivated " concurrencySafetySpecification" then
547+ focusOnConcurrencySafety () ;
550548
551- if isActivated " noOverflows" then focusOn noOverflows;
549+ if isActivated " noOverflows" then
550+ focusOnNoOverflows () ;
552551
553552 if isActivated " enums" && hasEnums file then
554553 set_bool " ana.int.enums" true ;
555554
556- if isActivated " singleThreaded " then
557- reduceThreadAnalyses () ;
555+ if isActivated " reduceAnalyses " then
556+ reduceAnalyses () ;
558557
559558 if isActivated " arrayDomain" then
560559 selectArrayDomains file;
0 commit comments