|
|
|
@ -544,8 +544,11 @@ module Prune = struct
|
|
|
|
|
let prune_has_next ~true_branch iterator ({mem} as astate) =
|
|
|
|
|
let accum_prune_common ~prune_f loc acc =
|
|
|
|
|
let length = collection_length_of_iterator iterator mem in
|
|
|
|
|
let v = prune_f (Mem.find loc mem) length in
|
|
|
|
|
update_mem_in_prune loc v acc
|
|
|
|
|
let v = Mem.find loc mem in
|
|
|
|
|
if Val.is_bot length || Val.is_bot v then acc
|
|
|
|
|
else
|
|
|
|
|
let v' = prune_f v length in
|
|
|
|
|
update_mem_in_prune loc v' acc
|
|
|
|
|
in
|
|
|
|
|
let accum_pruned loc tgt acc =
|
|
|
|
|
match tgt with
|
|
|
|
@ -575,15 +578,22 @@ module Prune = struct
|
|
|
|
|
match tgt with
|
|
|
|
|
| AliasTarget.Simple {i} when IntLit.iszero i ->
|
|
|
|
|
let v = Mem.find rhs mem in
|
|
|
|
|
if Val.is_bot v then acc
|
|
|
|
|
else
|
|
|
|
|
let v' = Val.prune_ne_zero v in
|
|
|
|
|
update_mem_in_prune rhs v' acc
|
|
|
|
|
| AliasTarget.Empty ->
|
|
|
|
|
let v = Mem.find rhs mem in
|
|
|
|
|
if Val.is_bot v then acc
|
|
|
|
|
else
|
|
|
|
|
let v' = Val.prune_length_eq_zero v in
|
|
|
|
|
update_mem_in_prune rhs v' acc
|
|
|
|
|
| AliasTarget.Fgets ->
|
|
|
|
|
let strlen_loc = Loc.of_c_strlen rhs in
|
|
|
|
|
let v' = Val.prune_ge_one (Mem.find strlen_loc mem) in
|
|
|
|
|
let v = Mem.find strlen_loc mem in
|
|
|
|
|
if Val.is_bot v then acc
|
|
|
|
|
else
|
|
|
|
|
let v' = Val.prune_ge_one v in
|
|
|
|
|
update_mem_in_prune strlen_loc v' acc
|
|
|
|
|
| AliasTarget.IteratorHasNext _ ->
|
|
|
|
|
prune_has_next ~true_branch:true rhs acc
|
|
|
|
@ -596,10 +606,14 @@ module Prune = struct
|
|
|
|
|
match tgt with
|
|
|
|
|
| AliasTarget.Simple {i} when IntLit.iszero i ->
|
|
|
|
|
let v = Mem.find rhs mem in
|
|
|
|
|
if Val.is_bot v then acc
|
|
|
|
|
else
|
|
|
|
|
let v' = Val.prune_eq_zero v in
|
|
|
|
|
update_mem_in_prune rhs v' acc
|
|
|
|
|
| AliasTarget.Empty ->
|
|
|
|
|
let v = Mem.find rhs mem in
|
|
|
|
|
if Val.is_bot v then acc
|
|
|
|
|
else
|
|
|
|
|
let v' = Val.prune_length_ge_one v in
|
|
|
|
|
update_mem_in_prune rhs v' acc
|
|
|
|
|
| AliasTarget.IteratorHasNext _ ->
|
|
|
|
@ -655,7 +669,7 @@ module Prune = struct
|
|
|
|
|
let v' = eval integer_type_widths e mem in
|
|
|
|
|
if IntLit.iszero i then v' else Val.minus_a v' (Val.of_int_lit i)
|
|
|
|
|
in
|
|
|
|
|
if Val.is_bot rhs then acc
|
|
|
|
|
if Val.is_bot lhs || Val.is_bot rhs then acc
|
|
|
|
|
else
|
|
|
|
|
let v = val_prune_eq lhs rhs in
|
|
|
|
|
let pruning_exp = make_pruning_exp ~lhs ~rhs in
|
|
|
|
@ -676,6 +690,8 @@ module Prune = struct
|
|
|
|
|
|> Val.of_itv |> Val.set_itv_updated_by_addition
|
|
|
|
|
in
|
|
|
|
|
let rhs = eval integer_type_widths e mem in
|
|
|
|
|
if Val.is_bot lhs || Val.is_bot rhs then astate
|
|
|
|
|
else
|
|
|
|
|
let prune_target val_prune astate =
|
|
|
|
|
let lhs' = val_prune lhs rhs in
|
|
|
|
|
let array_v' =
|
|
|
|
|