Commit bbac539e authored by Pietro Abate's avatar Pietro Abate

[r2004-09-22 11:51:48 by afrisch] Warning for division by zero

Original author: afrisch
Date: 2004-09-22 11:51:48+00:00
parent f8dda9db
......@@ -276,14 +276,14 @@ binary_op_cst "*"
| (Value.Integer x, Value.Integer y) -> Value.Integer (Intervals.V.mult x y)
| _ -> assert false);;
binary_op_cst "/"
int int int
binary_op_warning2 "/"
int int non_zero_int int
(fun v1 v2 -> match (v1,v2) with
| (Value.Integer x, Value.Integer y) -> Value.Integer (Intervals.V.div x y)
| _ -> assert false);;
binary_op_cst "mod"
int int int
binary_op_warning2 "mod"
int int non_zero_int int
(fun v1 v2 -> match (v1,v2) with
| (Value.Integer x, Value.Integer y) -> Value.Integer (Intervals.V.modulo x y)
| _ -> assert false);;
......
......@@ -13,6 +13,8 @@ let short_int = mk_interval_type "-32768" "32767"
let byte_int = mk_interval_type "-128" "127"
let caml_int = mk_interval_type (string_of_int min_int) (string_of_int max_int)
let non_zero_int = Types.cup pos_int neg_int
let pos_intstr =
Sequence.plus (Types.char (Chars.char_class
(Chars.V.mk_char '0')
......
......@@ -10,6 +10,8 @@ val short_int : Types.t (** -32768 .. 32767 *)
val byte_int : Types.t (** -128 .. 127 *)
val caml_int : Types.t (** min_int .. max_int *)
val non_zero_int : Types.t
val intstr : Types.t
val pos_intstr : Types.t
val neg_intstr : Types.t
......
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