[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
let havoc_actuals_without_typ_info astate =
List.fold actuals
~f:(fun astate actual_typ -> havoc_actual_if_ptr actual_typ None astate)
~init:astate
in
L.d_printfln "skipping unknown procedure@." ; L.d_printfln "skipping unknown procedure@." ;
( match formals_opt with ( match formals_opt with
| None -> | None ->
List.fold actuals havoc_actuals_without_typ_info astate
~f:(fun astate actual_typ -> havoc_actual_if_ptr actual_typ None astate)
~init: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