I have been working on some basic programs in c to verify using the frama-c tool.I wanted to know why the assertion is not being proved in the program.Thanks in advance.
#include <limits.h>
/*@requires \valid(a) && \valid(b) && \separated(a,b);
assigns \nothing;
ensures (*a>*b ==> \result == *b) &&
(*b>=*a ==> \result == *a);
*/
int max_ptr(int* a,int* b){
return (*a>*b)?*b:*a;
}
extern int h;
//@assigns x;
int main(){
h=42;
int a=24;
int b=42;
//@assert h ==42;
int x;
x=max_ptr(&a,&b);
//@ assert x == 42;
//@ assert h ==42;
return 0;
}
All the scheduled goals were successfully proved but except for the assertion statement:
//@ assert x == 42;
It was a timeout on the above assertion.Should there be any modifications to the function contract?