let assign env lv e wp =
on_context env "assign" wp Keep_opened Keep_assigns
(fun env assigns p ->
let frame = L.get_frame env in
let m = WpModel.mem_at frame Clabels.Here in
match addr m lv with
| Warning(source,reason) ->
Datalib.Collector.add_warning
~severe:true ~source ~reason
"No translation for l-value '%a'" !Ast_printer.d_lval lv ;
F.p_false
| Result l ->
let te = Cil.typeOf e in
let obj = Ctypes.object_of te in
let wp =
match expr m e with
| Warning(source,reason) ->
Datalib.Collector.add_warning ~source ~reason
"Ignored r-value of assignment" ;
let modified = D.Aloc(obj,l) in
D.havoc_static (WpModel.subst_havoc frame modified) p
| Result v ->
let t = Ctypes.object_of (Cil.typeOf e) in
WpModel.subst_lval frame t l v p
in
begin
match assigns with
| NoAssigns -> wp
| EffectAssigns a ->
let zl = WpModel.dzone_assigned (D.Aloc(obj,l)) in
let zs = WpModel.dzone_union (F.var a.a_effect) zl in
D.subst a.a_effect zs wp
| RegionAssigns r ->
let rl = WpModel.region_assigned (D.Aloc(obj,l)) in
F.p_implies (region_included rl r) wp
end )