[pulse] Havoc actuals when lengths of actuals and formals mismatch

Summary:
In Pulse, it usually havoc the actual parameters to unknown functions. However, it did not do that when the lengths of actuals and formals mismatch, which may happen when the frontend doesn't have enough information about procedures.

This diff havoc the actual parameters, also when there is mismatch between lengths of actuals and formals.

Reviewed By: ezgicicek

Differential Revision: D27163143

fbshipit-source-id: 1c5e0853a
master
Sungkeun Cho 4 years ago committed by Facebook GitHub Bot
parent 2b144509ab
commit 572080a8e9

@ -58,12 +58,15 @@ let unknown_call tenv call_loc reason ~ret ~actuals ~formals_opt astate =
| _ -> | _ ->
astate astate
in in
L.d_printfln "skipping unknown procedure@." ; let havoc_actuals_without_typ_info astate =
( match formals_opt with
| None ->
List.fold actuals List.fold actuals
~f:(fun astate actual_typ -> havoc_actual_if_ptr actual_typ None astate) ~f:(fun astate actual_typ -> havoc_actual_if_ptr actual_typ None astate)
~init:astate ~init:astate
in
L.d_printfln "skipping unknown procedure@." ;
( match formals_opt with
| None ->
havoc_actuals_without_typ_info astate
| Some formals -> ( | Some formals -> (
match match
List.fold2 actuals formals List.fold2 actuals formals
@ -74,7 +77,7 @@ let unknown_call tenv call_loc reason ~ret ~actuals ~formals_opt astate =
| Unequal_lengths -> | Unequal_lengths ->
L.d_printfln "ERROR: formals have length %d but actuals have length %d" L.d_printfln "ERROR: formals have length %d but actuals have length %d"
(List.length formals) (List.length actuals) ; (List.length formals) (List.length actuals) ;
astate havoc_actuals_without_typ_info astate
| Ok result -> | Ok result ->
result ) ) result ) )
|> havoc_ret ret |> add_skipped_proc |> havoc_ret ret |> add_skipped_proc

Loading…
Cancel
Save