8181 let name () = " def_exc"
8282
8383
84- let top_range = R. of_interval range_ikind (- 99L , 99L ) (* Since there is no top ikind we use a range that includes both ILongLong [-63,63 ] and IULongLong [0,64 ]. Only needed for intermediate range computation on longs. Correct range is set by cast. *)
85- let top () = `Excluded (S. empty () , top_range )
84+ let overflow_range = R. of_interval range_ikind (- 999L , 999L ) (* Since there is no top ikind we use a range that includes both IInt128 [-127,127 ] and IUInt128 [0,128 ]. Only needed for intermediate range computation on longs. Correct range is set by cast. *)
85+ let top_overflow () = `Excluded (S. empty () , overflow_range )
8686 let bot () = `Bot
8787 let top_of ik = `Excluded (S. empty () , size ik)
8888 let bot_of ik = bot ()
@@ -117,8 +117,6 @@ struct
117117 let upperb = Exclusion. max_of_range r in
118118 Z. compare i upperb < = 0
119119
120- let is_top x = x = top ()
121-
122120 let equal_to i = function
123121 | `Bot -> failwith " unsupported: equal_to with bottom"
124122 | `Definite x -> if i = x then `Eq else `Neq
@@ -351,10 +349,10 @@ struct
351349 (* We don't bother with exclusion sets : * )
352350 | `Excluded _, `Definite _
353351 | `Definite _, `Excluded _
354- | `Excluded _ , `Excluded _ -> top ()
352+ | `Excluded _ , `Excluded _ -> top_overflow ()
355353 (* The good case: *)
356354 | `Definite x , `Definite y ->
357- (try `Definite (f x y) with | Division_by_zero -> top () )
355+ (try `Definite (f x y) with | Division_by_zero -> top_overflow () )
358356 | `Bot , `Bot -> `Bot
359357 | _ ->
360358 (* If only one of them is bottom, we raise an exception that eval_rv will catch *)
@@ -367,7 +365,7 @@ struct
367365 norm ik @@
368366 match x,y with
369367 (* If both are exclusion sets , there isn't anything we can do : * )
370- | `Excluded _ , `Excluded _ -> top ()
368+ | `Excluded _ , `Excluded _ -> top_overflow ()
371369 (* A definite value should be applied to all members of the exclusion set *)
372370 | `Definite x , `Excluded (s ,r ) -> def_exc f x s r
373371 (* Same thing here, but we should flip the operator to map it properly *)
@@ -382,11 +380,11 @@ struct
382380 (* The equality check: *)
383381 let eq ik x y = match x,y with
384382 (* Not much to do with two exclusion sets : * )
385- | `Excluded _ , `Excluded _ -> top ()
383+ | `Excluded _ , `Excluded _ -> top_of IInt
386384 (* Is x equal to an exclusion set, if it is a member then NO otherwise we
387385 * don't know: *)
388- | `Definite x , `Excluded (s ,r ) -> if S. mem x s then of_bool IInt false else top ()
389- | `Excluded (s ,r ), `Definite x -> if S. mem x s then of_bool IInt false else top ()
386+ | `Definite x , `Excluded (s ,r ) -> if S. mem x s then of_bool IInt false else top_of IInt
387+ | `Excluded (s ,r ), `Definite x -> if S. mem x s then of_bool IInt false else top_of IInt
390388 (* The good case: *)
391389 | `Definite x , `Definite y -> of_bool IInt (x = y)
392390 | `Bot , `Bot -> `Bot
@@ -397,11 +395,11 @@ struct
397395 (* The inequality check: *)
398396 let ne ik x y = match x,y with
399397 (* Not much to do with two exclusion sets : * )
400- | `Excluded _ , `Excluded _ -> top ()
398+ | `Excluded _ , `Excluded _ -> top_of IInt
401399 (* Is x unequal to an exclusion set, if it is a member then Yes otherwise we
402400 * don't know: *)
403- | `Definite x , `Excluded (s ,r ) -> if S. mem x s then of_bool IInt true else top ()
404- | `Excluded (s ,r ), `Definite x -> if S. mem x s then of_bool IInt true else top ()
401+ | `Definite x , `Excluded (s ,r ) -> if S. mem x s then of_bool IInt true else top_of IInt
402+ | `Excluded (s ,r ), `Definite x -> if S. mem x s then of_bool IInt true else top_of IInt
405403 (* The good case: *)
406404 | `Definite x , `Definite y -> of_bool IInt (x <> y)
407405 | `Bot , `Bot -> `Bot
@@ -460,12 +458,12 @@ struct
460458 else if Z. equal i Z. one then
461459 of_interval IBool (Z. zero, Z. one)
462460 else
463- top ()
461+ top_of ik
464462 | `Definite _, `Excluded _
465- | `Excluded _ , `Excluded _ -> top ()
463+ | `Excluded _ , `Excluded _ -> top_of ik
466464 (* The good case: *)
467465 | `Definite x , `Definite y ->
468- (try `Definite (Z. logand x y) with | Division_by_zero -> top () )
466+ (try `Definite (Z. logand x y) with | Division_by_zero -> top_of ik )
469467 | `Bot , `Bot -> `Bot
470468 | _ ->
471469 (* If only one of them is bottom, we raise an exception that eval_rv will catch *)
0 commit comments