Skip to content
Snippets Groups Projects
Commit 09038ca5 authored by Allan Blanchard's avatar Allan Blanchard
Browse files

[wp] type logic function _calls_ with C type

parent e5f4b808
No related branches found
No related tags found
No related merge requests found
...@@ -681,7 +681,12 @@ struct ...@@ -681,7 +681,12 @@ struct
| ACSLDEF -> C.call_fun env result f ls vs | ACSLDEF -> C.call_fun env result f ls vs
| HACK phi -> phi vs | HACK phi -> phi vs
| LFUN f -> e_fun ~result f vs | LFUN f -> e_fun ~result f vs
in Vexp r in
begin match t.term_type with
| Ctype t -> Lang.assume (Cvalues.has_ctype t r)
| _ -> ()
end ;
Vexp r
| Tlambda _ -> | Tlambda _ ->
Warning.error "Lambda-functions not yet implemented" Warning.error "Lambda-functions not yet implemented"
......
...@@ -24,7 +24,13 @@ Prove: (0 <= L_t) /\ (L_t <= 127). ...@@ -24,7 +24,13 @@ Prove: (0 <= L_t) /\ (L_t <= 127).
------------------------------------------------------------ ------------------------------------------------------------
Goal Post-condition 'A' in 'g': Goal Post-condition 'A' in 'g':
Assume { (* Heap *) Type: region(p.base) <= 0. } Let x = Mint_0[p].
Prove: L_x(Mint_0, p) <= 255. Let x_1 = L_x(Mint_0, p).
Assume {
Type: is_uint8(x) /\ is_uint8(x_1).
(* Heap *)
Type: region(p.base) <= 0.
}
Prove: (x = x_1) /\ (x_1 <= 255).
------------------------------------------------------------ ------------------------------------------------------------
...@@ -43,15 +43,20 @@ end ...@@ -43,15 +43,20 @@ end
(* use frama_c_wp.memaddr.MemAddr *) (* use frama_c_wp.memaddr.MemAddr *)
(* use frama_c_wp.cint.Cint *)
(* use Axiomatic1 *) (* use Axiomatic1 *)
goal wp_goal : goal wp_goal :
forall t:addr -> int, a:addr. region (a.base) <= 0 -> L_x t a <= 255 forall t:addr -> int, a:addr.
let x = get t a in
let x1 = L_x t a in
region (a.base) <= 0 -> is_uint8 x -> is_uint8 x1 -> x = x1 /\ x1 <= 255
end end
[wp] [Unsuccess] typed_g_ensures_A (Alt-Ergo) (Cached) [wp] [Valid] typed_g_ensures_A (Alt-Ergo) (Cached)
[wp] Proved goals: 0 / 1 [wp] Proved goals: 1 / 1
Unsuccess: 1 Alt-Ergo: 1
------------------------------------------------------------ ------------------------------------------------------------
Functions WP Alt-Ergo Total Success Functions WP Alt-Ergo Total Success
g - - 1 0.0% g - 1 1 100%
------------------------------------------------------------ ------------------------------------------------------------
...@@ -16,5 +16,5 @@ ...@@ -16,5 +16,5 @@
@ ensures qed_ko: 0<=t<128 ; */ @ ensures qed_ko: 0<=t<128 ; */
void f(void) {return;} void f(void) {return;}
//@ ensures A: x(p) <= 255 ; //@ ensures A: *p == x(p) <= 255 ;
void g(unsigned char* p){} void g(unsigned char* p){}
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