I am a newbie at Frama-C and I am trying to validate a C code. The code is very basic but somehow I can not validate it.
In summary, I am trying to prove If that function or loop has ever run. For that, I give a variable a value (4) in the beginning. In the function, I change the value to "5", and I try to ensure that the variable 5 at the end.
The Code:
#include <stdio.h>
int x=4;
/*@
ensures x ==5;
*/
int abs(int val){
int accept=0;
int count=3;
/*@
loop invariant 0 <= count <= \at(count, Pre);
loop assigns accept,x,count;
loop variant count;
*/
while (count !=0){
x=5;
accept =1;
count--;
}
return x;
}
I give the command to CLI as "frama-c-gui -wp -rte testp4.c" to start frama-c.
As result: Frama-1
But the "*@ ensures x ≡ 5; */" is still unknown.
Is there anyone can help me about this ? If I take "x=5;" to outside of the while loop ( before return) It validates the /*@ ensures x ==5; */
Thanks in advance to everyone who contributed!