Skip to content
Snippets Groups Projects
Commit 79a6ec38 authored by Virgile Prevosto's avatar Virgile Prevosto
Browse files

Fixes long-standing bug in Aorai's logic simplifications

parent 67ff4b17
No related branches found
No related tags found
No related merge requests found
...@@ -312,32 +312,19 @@ let tand t1 t2 = ...@@ -312,32 +312,19 @@ let tand t1 t2 =
| TFalse,_ | _,TFalse -> TFalse | TFalse,_ | _,TFalse -> TFalse
| _,_ -> TAnd(t1,t2) | _,_ -> TAnd(t1,t2)
let has_result t =
let module M = struct exception Has_result end in
let vis = object
inherit Visitor.frama_c_inplace
method! vterm_lhost = function
| TResult _ -> raise M.Has_result
| _ -> Cil.DoChildren
end
in
try ignore (Visitor.visitFramacTerm vis t); false
with M.Has_result -> true
let rec tnot t = let rec tnot t =
match t with match t with
| TTrue -> TFalse | TTrue -> TFalse
| TFalse -> TTrue | TFalse -> TTrue
| TNot t -> t | TNot t -> t
(* If relation uses \result, keep information about which function | TAnd (TCall (c,b), t) ->
is returning close to it. *) TOr (TNot (TCall (c,b)), TAnd(TCall (c,b), tnot t))
| TAnd ((TReturn _ as t1), (TRel (_,op1,op2) as t2)) | TAnd (TReturn c, t) ->
when has_result op1 || has_result op2 -> TOr (TNot (TReturn c), TAnd(TReturn c, tnot t))
TOr (tnot t1, TAnd (t1, tnot t2)) | TAnd (t1,t2) -> TOr(tnot t1, tnot t2)
| TAnd (t1,t2) -> TOr(tnot t1, tnot t2) | TOr (t1,t2) -> TAnd(tnot t1, tnot t2)
| TOr (t1,t2) -> TAnd(tnot t1, tnot t2) | TRel(rel,t1,t2) -> TRel(opposite_rel rel, t1, t2)
| TRel(rel,t1,t2) -> TRel(opposite_rel rel, t1, t2) | TCall _ | TReturn _ -> TNot t
| TCall _ | TReturn _ -> TNot t
let tands l = List.fold_right tand l TTrue let tands l = List.fold_right tand l TTrue
......
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