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

test for conversion issue

parent c1ca1c91
No related branches found
No related tags found
No related merge requests found
/* run.config /* run.config
EXECNOW: make -s @PTEST_DIR@/@PTEST_NAME@.cmxs MODULE: @PTEST_DIR@/@PTEST_NAME@.cmxs
OPT: -no-autoload-plugins -load-module @PTEST_DIR@/@PTEST_NAME@.cmxs -print OPT: -print
*/ */
int x[10]; int x[10];
...@@ -28,3 +28,8 @@ int main() { ...@@ -28,3 +28,8 @@ int main() {
s.z = 3; s.z = 3;
t = 4; t = 4;
} }
/*@ ensures int_eq((int)!t,(int)5); */
int g() {
if (!t) return 2; else return 3;
}
...@@ -6,6 +6,7 @@ let check_expr_term check fct s e = ...@@ -6,6 +6,7 @@ let check_expr_term check fct s e =
let exp = let exp =
match s.skind with match s.skind with
| Instr (Set (lv,_,loc)) -> Cil.new_exp ~loc (Lval lv) | Instr (Set (lv,_,loc)) -> Cil.new_exp ~loc (Lval lv)
| If (c,_,_,_) -> c
| _ -> Kernel.fatal "Unexpected statement %a" Printer.pp_stmt s | _ -> Kernel.fatal "Unexpected statement %a" Printer.pp_stmt s
in in
let term = let term =
...@@ -23,7 +24,6 @@ let check_expr_term check fct s e = ...@@ -23,7 +24,6 @@ let check_expr_term check fct s e =
let post = Logic_const.new_predicate app in let post = Logic_const.new_predicate app in
Annotations.add_ensures emitter fct [Normal,post] Annotations.add_ensures emitter fct [Normal,post]
let treat_fct check fct = let treat_fct check fct =
let stmts = (Kernel_function.get_definition fct).sbody.bstmts in let stmts = (Kernel_function.get_definition fct).sbody.bstmts in
let stmts = let stmts =
...@@ -31,6 +31,7 @@ let treat_fct check fct = ...@@ -31,6 +31,7 @@ let treat_fct check fct =
(function (function
{ skind = Instr (Set (lv,_,_)) } -> { skind = Instr (Set (lv,_,_)) } ->
(match lv with (Var v,_) -> v.vglob | _ -> true) (match lv with (Var v,_) -> v.vglob | _ -> true)
| { skind = If _ } -> true
| _ -> false) | _ -> false)
stmts stmts
in in
...@@ -49,8 +50,10 @@ let treat_fct check fct = ...@@ -49,8 +50,10 @@ let treat_fct check fct =
let compute () = let compute () =
let main = Globals.Functions.find_by_name "main" in let main = Globals.Functions.find_by_name "main" in
let f = Globals.Functions.find_by_name "f" in let f = Globals.Functions.find_by_name "f" in
let g = Globals.Functions.find_by_name "g" in
treat_fct true main; treat_fct true main;
treat_fct false f treat_fct false f;
treat_fct true g
let () = Db.Main.extend compute let () = Db.Main.extend compute
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