From 7e4f5ec43bd0a0f80c6750cc036d5f0868d96fb9 Mon Sep 17 00:00:00 2001 From: Nikos Gorogiannis Date: Sat, 12 Jun 2021 03:07:16 -0700 Subject: [PATCH] [starvation] default to recursive if type unknown Summary: As per title. Reviewed By: jvillard Differential Revision: D29066300 fbshipit-source-id: fd269835a --- infer/src/concurrency/starvationDomain.ml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/infer/src/concurrency/starvationDomain.ml b/infer/src/concurrency/starvationDomain.ml index a4f208620..fbb3f4612 100644 --- a/infer/src/concurrency/starvationDomain.ml +++ b/infer/src/concurrency/starvationDomain.ml @@ -128,9 +128,8 @@ module Lock = struct let is_recursive tenv lock = - (* The "default" below is returned when we don't have enough information. We choose - the default depending on the language, since most Java locks are recursive and most C++ locks - are not. *) + (* We default to recursive if the type can't be found or looks malformed. + This reduces self-deadlock FPs. *) match get_typ tenv lock with | Some {Typ.desc= Tptr ({desc= Tstruct name}, _) | Tstruct name} -> ConcurrencyModels.is_recursive_lock_type name @@ -138,11 +137,11 @@ module Lock = struct (* weird type passed as a lock, return default *) L.debug Analysis Verbose "Asked if non-struct type %a is a recursive lock type.@\n" (Typ.pp_full Pp.text) typ ; - Language.curr_language_is Java + true | None -> (* could not find type definition, return default *) L.debug Analysis Verbose "Could not resolve type for lock %a.@\n" pp lock ; - Language.curr_language_is Java + true end module AccessExpressionDomain = struct