diff --git a/tests/spec/generalized_check.i b/tests/spec/generalized_check.i new file mode 100644 index 0000000000000000000000000000000000000000..1409e3efc7af975c24e55cdebc9c4edc3971ab49 --- /dev/null +++ b/tests/spec/generalized_check.i @@ -0,0 +1,16 @@ +/*@ check lemma tauto: \true ==> \true; */ + +/*@ check requires \valid(x); + assigns *x; + check ensures *x == 0; +*/ +void f(int* x) { + /*@ check \valid(x); */ // can't be proved by WP: we ignore the requires + *x = 0; +} + +int main() { + int a = 4; + f(&a); + /*@ check a == 0; */ // can't be proved by WP: we ignore the ensures +} diff --git a/tests/spec/oracle/generalized_check.res.oracle b/tests/spec/oracle/generalized_check.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..7017e6e7b8408180fb254621bf34a2de945a6d65 --- /dev/null +++ b/tests/spec/oracle/generalized_check.res.oracle @@ -0,0 +1,25 @@ +[kernel] Parsing tests/spec/generalized_check.i (no preprocessing) +/* Generated by Frama-C */ +/*@ check lemma tauto: \true; + */ +/*@ check requires \valid(x); + check ensures *\old(x) ≡ 0; + assigns *x; */ +void f(int *x) +{ + /*@ check \valid(x); */ ; + *x = 0; + return; +} + +int main(void) +{ + int __retres; + int a = 4; + f(& a); + /*@ check a ≡ 0; */ ; + __retres = 0; + return __retres; +} + +