|
|
|
@ -194,25 +194,6 @@ let rec find_boolean_assignment node pvar true_branch : Cfg.Node.t option =
|
|
|
|
|
else None
|
|
|
|
|
| _ -> None
|
|
|
|
|
|
|
|
|
|
(** Check whether the program variable is a temporary one generated by CIL *)
|
|
|
|
|
let pvar_is_cil_tmp pvar =
|
|
|
|
|
Pvar.is_local pvar &&
|
|
|
|
|
let name = Pvar.to_string pvar in
|
|
|
|
|
string_is_prefix "_tmp" name
|
|
|
|
|
|
|
|
|
|
(** Check whether the program variable is a temporary one generated by sawja *)
|
|
|
|
|
let pvar_is_sawja_tmp pvar =
|
|
|
|
|
Pvar.is_local pvar &&
|
|
|
|
|
let name = Pvar.to_string pvar in
|
|
|
|
|
string_is_prefix "$irvar" name ||
|
|
|
|
|
string_is_prefix "$T" name ||
|
|
|
|
|
string_is_prefix "$bc" name
|
|
|
|
|
|
|
|
|
|
(** Check whether the program variable is a temporary generated by the front-end *)
|
|
|
|
|
let pvar_is_frontend_tmp pvar =
|
|
|
|
|
if !Config.curr_language = Config.Java then pvar_is_sawja_tmp pvar
|
|
|
|
|
else pvar_is_cil_tmp pvar
|
|
|
|
|
|
|
|
|
|
(** Find the Letderef instruction used to declare normal variable [id],
|
|
|
|
|
and return the expression dereferenced to initialize [id] *)
|
|
|
|
|
let rec _find_normal_variable_letderef (seen : Sil.ExpSet.t) node id : Sil.dexp option =
|
|
|
|
@ -288,7 +269,7 @@ and _exp_lv_dexp (_seen : Sil.ExpSet.t) node e : Sil.dexp option =
|
|
|
|
|
| Some de -> Some (Sil.Dderef de))
|
|
|
|
|
| Sil.Lvar pvar ->
|
|
|
|
|
if verbose then (L.d_str "exp_lv_dexp: program var "; Sil.d_exp e; L.d_ln ());
|
|
|
|
|
if pvar_is_frontend_tmp pvar then
|
|
|
|
|
if Pvar.is_frontend_tmp pvar then
|
|
|
|
|
begin
|
|
|
|
|
match find_program_variable_assignment node pvar with
|
|
|
|
|
| None -> None
|
|
|
|
@ -361,7 +342,7 @@ and _exp_rv_dexp (_seen : Sil.ExpSet.t) node e : Sil.dexp option =
|
|
|
|
|
Some (Sil.Dconst c)
|
|
|
|
|
| Sil.Lvar pv ->
|
|
|
|
|
if verbose then (L.d_str "exp_rv_dexp: program var "; Sil.d_exp e; L.d_ln ());
|
|
|
|
|
if pvar_is_frontend_tmp pv
|
|
|
|
|
if Pvar.is_frontend_tmp pv
|
|
|
|
|
then _exp_lv_dexp _seen (* avoid spurious cycle detection *) node e
|
|
|
|
|
else Some (Sil.Dpvaraddr pv)
|
|
|
|
|
| Sil.Var id when Ident.is_normal id ->
|
|
|
|
@ -510,7 +491,7 @@ let explain_leak tenv hpred prop alloc_att_opt bucket =
|
|
|
|
|
let check_pvar pvar =
|
|
|
|
|
(* check that pvar is local or global and has the same type as the leaked hpred *)
|
|
|
|
|
(Pvar.is_local pvar || Pvar.is_global pvar) &&
|
|
|
|
|
not (pvar_is_frontend_tmp pvar) &&
|
|
|
|
|
not (Pvar.is_frontend_tmp pvar) &&
|
|
|
|
|
match hpred_typ_opt, find_typ_without_ptr prop pvar with
|
|
|
|
|
| Some (Sil.Sizeof (t1, _, _)), Some (Sil.Sizeof (Typ.Tptr (t2_, _), _, _)) ->
|
|
|
|
|
(try
|
|
|
|
@ -545,7 +526,7 @@ let explain_leak tenv hpred prop alloc_att_opt bucket =
|
|
|
|
|
| _ -> [] in
|
|
|
|
|
let nullify_pvars = IList.flatten (IList.map get_nullify node_instrs) in
|
|
|
|
|
let nullify_pvars_notmp =
|
|
|
|
|
IList.filter (fun pvar -> not (pvar_is_frontend_tmp pvar)) nullify_pvars in
|
|
|
|
|
IList.filter (fun pvar -> not (Pvar.is_frontend_tmp pvar)) nullify_pvars in
|
|
|
|
|
value_str_from_pvars_vpath nullify_pvars_notmp vpath
|
|
|
|
|
| Some (Sil.Set (lexp, _, _, _)) when vpath = None ->
|
|
|
|
|
if verbose
|
|
|
|
@ -609,7 +590,7 @@ let vpath_find prop _exp : Sil.dexp option * Typ.t option =
|
|
|
|
|
| Sil.Eexp (e, _) when Sil.exp_equal exp e ->
|
|
|
|
|
let sigma' = (IList.rev_append sigma_acc' sigma_todo') in
|
|
|
|
|
(match lexp with
|
|
|
|
|
| Sil.Lvar pv when not (pvar_is_frontend_tmp pv) ->
|
|
|
|
|
| Sil.Lvar pv when not (Pvar.is_frontend_tmp pv) ->
|
|
|
|
|
let typo = match texp with
|
|
|
|
|
| Sil.Sizeof (typ, _, _) -> Some typ
|
|
|
|
|
| _ -> None in
|
|
|
|
|