You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(* Eq case is unnecessary: Q.must_be_equal reconstructs BinOp (Eq, _, _, _) and repeats EvalInt query for that, yielding a top from query cycle and never being must equal *)
1004
-
|Le
1005
-
|Gewhen must_be_equal () ->
1006
-
let ik =Cilfacade.get_ikind t in
1007
-
Int (ID.of_bool ik true)
1008
-
|Ne
1009
-
|Lt
1010
-
|Gtwhen must_be_equal () ->
1011
-
let ik =Cilfacade.get_ikind t in
1012
-
Int (ID.of_bool ik false)
1013
-
|_ -> r (* Fallback didn't help. *)
1014
-
)
1015
-
else
1016
-
r (* Avoid fallback, above cases are for ints only. *)
982
+
try
983
+
let t1 =Option.default_delayed (fun() -> Cilfacade.typeOf e1) t1 in
984
+
let t2 =Option.default_delayed (fun() -> Cilfacade.typeOf e2) t2 in
985
+
let r = evalbinop_base ~ctx op t1 a1 t2 a2 t in
986
+
ifCil.isIntegralType t then (
987
+
match r with
988
+
|IntiwhenID.to_int i <>None -> r (* Avoid fallback, cannot become any more precise. *)
989
+
|_ ->
990
+
(* Fallback to MustBeEqual query, could get extra precision from exprelation/var_eq. *)
991
+
letmust_be_equal()=
992
+
let r =Q.must_be_equal (Analyses.ask_of_ctx ctx) e1 e2 in
(* Eq case is unnecessary: Q.must_be_equal reconstructs BinOp (Eq, _, _, _) and repeats EvalInt query for that, yielding a top from query cycle and never being must equal *)
1005
+
|Le
1006
+
|Gewhen must_be_equal () ->
1007
+
let ik =Cilfacade.get_ikind t in
1008
+
Int (ID.of_bool ik true)
1009
+
|Ne
1010
+
|Lt
1011
+
|Gtwhen must_be_equal () ->
1012
+
let ik =Cilfacade.get_ikind t in
1013
+
Int (ID.of_bool ik false)
1014
+
|_ -> r (* Fallback didn't help. *)
1015
+
)
1016
+
else
1017
+
r (* Avoid fallback, above cases are for ints only. *)
1018
+
withCilfacade.TypeOfError_ ->
1019
+
(* Emit top value of corresponding type when there are issues *)
1020
+
VD.top_value t
1017
1021
1018
1022
(* A hackish evaluation of expressions that should immediately yield an
0 commit comments