let quantify_assigns assigns p =
try
let env = new_env () in
let quantify_assigns_elem p asgn =
match fst asgn with
| Location { it_content = { term_node = Tempty_set } }
| Nothing ->
Wp_parameters.debug ~level:2 "[wp-Mv] process assign : nothing@.";
p
| Location { it_content = lv} ->
match lv.term_node with
| TLval tlval ->
begin try
let out_type = lv.term_type in
let out_lvar = Cil_const.make_logic_var "out" out_type in
let out_type = Types.mk_ltype out_type in
let out_var = Fol.mk_lvar_variable out_lvar out_type in
let lval = !Db.Properties.Interp.term_lval_to_lval tlval in
Wp_parameters.debug ~level:2
"[wp-Mv] process assign %a as %a@."
!Ast_printer.d_lval lval Why_output.pp_var out_var;
let p = assign_old_exp env lval (Some (Fol.Tvar out_var)) p in
let p = MT.pred_forall ~fresh:false out_var p in
p
with Invalid_argument _
| Calculus.InvalidModel _
| Types.Unsupported _ ->
let str = Pretty_utils.sfprintf "%a"
!Ast_printer.d_term_lval tlval in
abort ("this assigns term is not handled yet: "^str)
end
| Tat
({term_node = TLval (TResult _, TNoOffset)} , LogicLabel "Post")
-> p
| _ ->
let str = Pretty_utils.sfprintf "%a" !Ast_printer.d_term lv in
abort ("assigns term is not a lvalue :"^str)
in
let p = List.fold_left quantify_assigns_elem p assigns in
let p = replace_at_vars env (LogicLabel "Old") p in
p
with Types.Unsupported t ->
let msg = "unsupported type in 'assign' expression: "^t in
raise (Calculus.InvalidModel msg)