Skip to content
Snippets Groups Projects
Commit be3154c8 authored by Basile Desloges's avatar Basile Desloges
Browse files

[eacsl] Add a "not yet" error in case of GMP loop variant

parent 1376b821
No related branches found
No related tags found
No related merge requests found
...@@ -48,32 +48,37 @@ let handle_annotations env kf stmt = ...@@ -48,32 +48,37 @@ let handle_annotations env kf stmt =
| Loop(_, ({ bstmts = stmts } as blk), loc, cont, break) -> | Loop(_, ({ bstmts = stmts } as blk), loc, cont, break) ->
(* Loop variant, save the current value of the variant *) (* Loop variant, save the current value of the variant *)
let stmts, env, variant = let stmts, env, variant =
match Env.top_loop_variant env with Error.handle
| Some (t, measure_opt) -> (fun (stmts, env, _) ->
let env = Env.set_annotation_kind env Smart_stmt.Variant in match Env.top_loop_variant env with
let env = Env.push env in | Some (t, measure_opt) ->
Typing.type_term ~use_gmp_opt:true t; let env = Env.set_annotation_kind env Smart_stmt.Variant in
let ty = Typing.get_typ t in let env = Env.push env in
let e, env = !term_to_exp_ref kf env t in Typing.type_term ~use_gmp_opt:true t;
let vi_old, e_old, env = let ty = Typing.get_typ t in
Env.new_var if Gmp_types.is_t ty then Error.not_yet "loop variant using GMP";
~loc let e, env = !term_to_exp_ref kf env t in
~scope:Varname.Function let vi_old, e_old, env =
~name:"old_variant" Env.new_var
env ~loc
kf ~scope:Varname.Function
(Some t) ~name:"old_variant"
ty env
(fun _ _ -> []) kf
in (Some t)
let stmt = ty
Smart_stmt.assigns ~loc ~result:(Cil.var vi_old) e (fun _ _ -> [])
in in
let blk, env = let stmt =
Env.pop_and_get env stmt ~global_clear:false Env.Middle Smart_stmt.assigns ~loc ~result:(Cil.var vi_old) e
in in
Smart_stmt.block_stmt blk :: stmts, env, Some (t, e_old, measure_opt) let blk, env =
| None -> stmts, env, None Env.pop_and_get env stmt ~global_clear:false Env.Middle
in
let stmts = Smart_stmt.block_stmt blk :: stmts in
stmts, env, Some (t, e_old, measure_opt)
| None -> stmts, env, None)
(stmts, env, None)
in in
(* Auxiliary function to generate variant and invariant checks *) (* Auxiliary function to generate variant and invariant checks *)
let rec aux (stmts, env) = function let rec aux (stmts, env) = function
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment