Skip to content
Snippets Groups Projects
Commit 6217c36c authored by Thibaut Benjamin's avatar Thibaut Benjamin
Browse files

[e-acsl] review

parent c80b4dda
No related branches found
No related tags found
No related merge requests found
...@@ -708,15 +708,21 @@ and number_ty_bound_variable ~profile (t1, lv, t2) = ...@@ -708,15 +708,21 @@ and number_ty_bound_variable ~profile (t1, lv, t2) =
let i = Interval.(widen (join i1 i2)) in let i = Interval.(widen (join i1 i2)) in
match lv.lv_type with match lv.lv_type with
| Linteger -> | Linteger ->
(match t2.term_type with let t2 = Logic_utils.remove_logic_coerce t2 in
| Ctype (TInt (ik, _) as typ) when let ty =
Interval.is_included i (Interval.interv_of_typ typ) match t2.term_type with
-> mk_ctx ~use_gmp_opt:true (C_integer ik) | Ctype typ ->
| _ -> (match t2.term_node with (match Cil.unrollType typ with
| TLogic_coerce(_, {term_type = Ctype (TInt (ik, _) as typ)}) when | TInt (ik, _) | TEnum({ ekind = ik }, _) when
Interval.is_included i (Interval.interv_of_typ typ) Interval.is_included i (Interval.interv_of_typ typ)
-> mk_ctx ~use_gmp_opt:true (C_integer ik) -> Some (C_integer ik)
| _ -> mk_ctx ~use_gmp_opt:true (ty_of_interv ~ctx:Gmpz i))) | TInt _ | TEnum _ | TFloat _ | TVoid _ | TPtr _ | TArray _ | TFun _
| TComp _ | TBuiltin_va_list _ | TNamed _ -> None)
| _ -> None
in
(match ty with
| Some ty -> mk_ctx ~use_gmp_opt:true ty
| None -> mk_ctx ~use_gmp_opt:true (ty_of_interv ~ctx:Gmpz i))
| Ctype ty -> | Ctype ty ->
(match Cil.unrollType ty with (match Cil.unrollType ty with
| TInt(ik, _) | TEnum({ ekind = ik}, _)-> join | TInt(ik, _) | TEnum({ ekind = ik}, _)-> join
...@@ -839,25 +845,34 @@ and ctx_relation ~profile t1 t2 = ...@@ -839,25 +845,34 @@ and ctx_relation ~profile t1 t2 =
let i1 = Interval.get_from_profile ~profile t1 in let i1 = Interval.get_from_profile ~profile t1 in
let i2 = Interval.get_from_profile ~profile t2 in let i2 = Interval.get_from_profile ~profile t2 in
let i = Interval.join i1 i2 in let i = Interval.join i1 i2 in
match t1.term_type with let t1 = Logic_utils.remove_logic_coerce t1 in
| Ctype (TInt (ik, _) as typ) when let ty1 =
Interval.is_included i (Interval.interv_of_typ typ) match t1.term_type with
-> mk_ctx ~use_gmp_opt:true (C_integer ik) | Ctype typ ->
| _ -> (match Cil.unrollType typ with
| TInt (ik, _) | TEnum({ ekind = ik }, _) when
Interval.is_included i (Interval.interv_of_typ typ)
-> Some (C_integer ik)
| TInt _ | TEnum _ | TFloat _ | TVoid _ | TPtr _ | TArray _ | TFun _
| TComp _ | TBuiltin_va_list _ | TNamed _ -> None)
| _ -> None
in
let t2 = Logic_utils.remove_logic_coerce t2 in
let ty2 =
match t2.term_type with match t2.term_type with
| Ctype (TInt (ik, _) as typ) when | Ctype typ ->
Interval.is_included i (Interval.interv_of_typ typ) (match Cil.unrollType typ with
-> mk_ctx ~use_gmp_opt:true (C_integer ik) | TInt (ik, _) | TEnum({ ekind = ik }, _) when
| _ -> match t1.term_node with Interval.is_included i (Interval.interv_of_typ typ)
| TLogic_coerce(_, {term_type = Ctype (TInt (ik, _) as typ)}) when -> Some (C_integer ik)
Interval.is_included i (Interval.interv_of_typ typ) | TInt _ | TEnum _ | TFloat _ | TVoid _ | TPtr _ | TArray _ | TFun _
-> mk_ctx ~use_gmp_opt:true (C_integer ik) | TComp _ | TBuiltin_va_list _ | TNamed _ -> None)
| _ -> match t2.term_node with | _ -> None
| TLogic_coerce(_, {term_type = Ctype (TInt (ik, _) as typ)}) when in
Interval.is_included i (Interval.interv_of_typ typ) match ty1, ty2 with
-> mk_ctx ~use_gmp_opt:true (C_integer ik) | Some ty, _
| _ -> mk_ctx ~use_gmp_opt:true (ty_of_interv ~ctx:c_int i) | None, Some ty -> mk_ctx ~use_gmp_opt:true ty
| None, None -> mk_ctx ~use_gmp_opt:true (ty_of_interv ~ctx:c_int i)
let type_term ~use_gmp_opt ?ctx ~profile t = let type_term ~use_gmp_opt ?ctx ~profile t =
Options.feedback ~dkey ~level:4 "typing term '%a' in ctx '%a'." Options.feedback ~dkey ~level:4 "typing term '%a' in ctx '%a'."
......
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