diff --git a/infer/src/pulse/PulseAbductiveDomain.ml b/infer/src/pulse/PulseAbductiveDomain.ml index 3d82aeca7b..802c647a18 100644 --- a/infer/src/pulse/PulseAbductiveDomain.ml +++ b/infer/src/pulse/PulseAbductiveDomain.ml @@ -1670,15 +1670,18 @@ let mk_initial tenv (proc_attrs : ProcAttributes.t) = let are_same_values_as_pre_formals proc_desc values astate = List.for_all2 (Procdesc.get_formals proc_desc) values ~f:(fun (mangled_name, _, _) v -> - let formal = Pvar.mk mangled_name (Procdesc.get_proc_name proc_desc) in - let formal_addr = - SafeStack.find_opt `Pre (Var.of_pvar formal) astate |> Option.value_exn |> ValueOrigin.value - in - let formal_v = - SafeMemory.find_edge_opt `Pre formal_addr Dereference astate - |> Option.value_exn |> fst |> downcast - in - AbstractValue.equal formal_v v ) + if Language.curr_language_is Hack && Mangled.is_self mangled_name then true + else + let formal = Pvar.mk mangled_name (Procdesc.get_proc_name proc_desc) in + let formal_addr = + SafeStack.find_opt `Pre (Var.of_pvar formal) astate + |> Option.value_exn |> ValueOrigin.value + in + let formal_v = + SafeMemory.find_edge_opt `Pre formal_addr Dereference astate + |> Option.value_exn |> fst |> downcast + in + AbstractValue.equal formal_v v ) |> function List.Or_unequal_lengths.Ok b -> b | List.Or_unequal_lengths.Unequal_lengths -> false diff --git a/infer/tests/codetoanalyze/hack/pulse/issues.exp b/infer/tests/codetoanalyze/hack/pulse/issues.exp index 47425e09df..8b5d2d7e81 100644 --- a/infer/tests/codetoanalyze/hack/pulse/issues.exp +++ b/infer/tests/codetoanalyze/hack/pulse/issues.exp @@ -225,7 +225,7 @@ recursion.hack, Recursion::AA$static.something, 1, INFINITE_RECURSION, no_bucket recursion.hack, Recursion::AA$static.something_else, 1, INFINITE_RECURSION, no_bucket, WARNING, [`Recursion::AA$static.something_else` calls `Recursion::BB$static.something`,`Recursion::BB$static.something` calls `Recursion::BB$static.something_else`,`Recursion::BB$static.something_else` calls `Recursion::AA$static.something`,`Recursion::AA$static.something` makes a recursive call to `Recursion::AA$static.something_else` with the same argument values] recursion.hack, Recursion::BB$static.something, 1, INFINITE_RECURSION, no_bucket, WARNING, [`Recursion::BB$static.something` calls `Recursion::BB$static.something_else`,`Recursion::BB$static.something_else` calls `Recursion::AA$static.something`,`Recursion::AA$static.something` calls `Recursion::AA$static.something_else`,`Recursion::AA$static.something_else` makes a recursive call to `Recursion::BB$static.something` with the same argument values] recursion.hack, Recursion::BB$static.something_else, 1, INFINITE_RECURSION, no_bucket, WARNING, [`Recursion::BB$static.something_else` calls `Recursion::AA$static.something`,`Recursion::AA$static.something` calls `Recursion::AA$static.something_else`,`Recursion::AA$static.something_else` calls `Recursion::BB$static.something`,`Recursion::BB$static.something` makes a recursive call to `Recursion::BB$static.something_else` with the same argument values] -recursion.hack, Recursion::InfiniteRecursionInTrait.infinite_same_args_bad, 1, MUTUAL_RECURSION_CYCLE, no_bucket, WARNING, [`Recursion::InfiniteRecursionInTrait.infinite_same_args_bad` makes a recursive call to `Recursion::InfiniteRecursionInTrait.infinite_same_args_bad`] +recursion.hack, Recursion::InfiniteRecursionInTrait.infinite_same_args_bad, 1, INFINITE_RECURSION, no_bucket, WARNING, [`Recursion::InfiniteRecursionInTrait.infinite_same_args_bad` makes a recursive call to `Recursion::InfiniteRecursionInTrait.infinite_same_args_bad` with the same argument values] return_type_matcher.hack, ReturnTypeMatcher::Flows$static.source1TaintFlowBad, 2, TAINT_ERROR, no_bucket, ERROR, [source of the taint here: value returned from `ReturnTypeMatcher::Source1$static.getTainted` with kind `ReturnTypeMatcher`,flows to this sink: value passed as argument `#0` to `ReturnTypeMatcher::Sink$static.process` with kind `ReturnTypeMatcher`], source: ReturnTypeMatcher::Source1$static.getTainted, sink: ReturnTypeMatcher::Sink$static.process, tainted expression: $source return_type_matcher.hack, ReturnTypeMatcher::Flows$static.source2TaintFlowBad, 2, TAINT_ERROR, no_bucket, ERROR, [source of the taint here: value returned from `ReturnTypeMatcher::Source2$static.getTainted` with kind `ReturnTypeMatcher`,flows to this sink: value passed as argument `#0` to `ReturnTypeMatcher::Sink$static.process` with kind `ReturnTypeMatcher`], source: ReturnTypeMatcher::Source2$static.getTainted, sink: ReturnTypeMatcher::Sink$static.process, tainted expression: $source sanitizers.hack, Sanitizers::Flows$static.taintedNotSanitizedBad, 2, TAINT_ERROR, no_bucket, ERROR, [source of the taint here: value returned from `Sanitizers::Source.getTainted` with kind `Sanitizers`,flows to this sink: value passed as argument `#0` to `Sanitizers::Sink$static.process` with kind `Sanitizers`], source: Sanitizers::Source.getTainted, sink: Sanitizers::Sink$static.process, tainted expression: $t