Attention une mise à jour du service Gitlab va être effectuée le mardi 18 janvier (et non lundi 17 comme annoncé précédemment) entre 18h00 et 18h30. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes.

Commit f8dd6af6 authored by MARCHE Claude's avatar MARCHE Claude
Browse files

negative literals: protect against bad usage of ls_of_const

parent 6ee33b56
......@@ -524,9 +524,9 @@ let rec tr_positive p = match kind_of_term p with
| _ ->
raise NotArithConstant
let const_of_big_int is_negative b =
let const_of_big_int is_neg b =
Term.t_const
(Number.(ConstInt { ic_negative = is_negative ;
(Number.(ConstInt { ic_negative = is_neg ;
ic_abs = Number.int_const_dec (Big_int.string_of_big_int b) }))
ty_int
......
......@@ -83,8 +83,10 @@ let lsdecl_of_ts ts = create_param_decl (ls_of_ts ts)
(* convert a constant to a functional symbol of type ty_base *)
let ls_of_const =
Hty.memo 3 (fun ty_base ->
Hterm.memo 63 (fun t -> match t.t_node with
| Tconst _ ->
Hterm.memo 63 (fun t ->
match t.t_node with
| Tconst c ->
assert (not (Number.is_negative c));
let s = "const_" ^ Pp.string_of_wnl Pretty.print_term t in
create_fsymbol (id_fresh s) [] ty_base
| _ -> assert false))
......
......@@ -37,6 +37,11 @@ type constant =
| ConstInt of integer_constant
| ConstReal of real_constant
let is_negative c =
match c with
| ConstInt i -> i.ic_negative
| ConstReal r -> r.rc_negative
exception InvalidConstantLiteral of int * string
let invalid_constant_literal n s = raise (InvalidConstantLiteral(n,s))
......
......@@ -39,6 +39,8 @@ type constant =
| ConstInt of integer_constant
| ConstReal of real_constant
val is_negative : constant -> bool
val int_const_dec : string -> integer_literal
val int_const_hex : string -> integer_literal
val int_const_oct : string -> integer_literal
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment