method vinst vi =
match vi with
| Set (lval,_,_) ->
if self#is_DoMemAccess () then
self#queue_assertion (get_lval_assertion lval)
;
DoChildren
| Call (ret_opt,funcexp,argl,_) -> (
if not(self#is_DoCalledPrecond ()) then
DoChildren
else
match funcexp.enode with
| Lval (Var vinfo,NoOffset) ->
let kf = Globals.Functions.get vinfo in
let do_no_implicit_cast () =
let formals = Kernel_function.get_formals kf in
if (List.length formals <> List.length argl) then (
rte_warn
"(%a) function call with # actuals <> # formals: not treated"
d_stmt (Extlib.the (self#current_stmt))
;
DoChildren
) else (
let formals_actuals_terms =
List.rev_map2
(fun formal arg_exp ->
(formal,
Logic_utils.expr_to_term ~cast:true arg_exp)
)
formals argl in
match self#make_stmt_contract kf formals_actuals_terms ret_opt with
| None -> DoChildren
| Some contract_stmt ->
self#queue_stmt_spec contract_stmt
;
DoChildren
)
in (
match ret_opt with
| None -> do_no_implicit_cast ()
| Some lv ->
let kf_ret_type = Kernel_function.get_return_type kf
and lv_type = Cil.typeOfLval lv in
if Cil.need_cast kf_ret_type lv_type then (
rte_warn "(%a) function call with intermediate cast: not treated"
d_stmt (Extlib.the (self#current_stmt))
;
DoChildren
)
else do_no_implicit_cast ()
)
| Lval (Mem _,NoOffset) ->
rte_warn "(%a) function called through a pointer: not treated"
d_stmt (Extlib.the (self#current_stmt))
;
DoChildren
| _ -> assert false
)
| _ -> DoChildren