As example I use the following function:
float nondet_float(){
float x;
return x;
}
int main(){
float x = nondet_float();
if(isnan(x)){
some_error();
}
}
I wonder how I have to use frama-c, to simulate non-deterministic floats.
Want I want is, that the variable x, is considered to be any possible float value, including -inf, +inf and NaN.
I'd like to get the result that some_error() is reachable, if x is NaN.
So my question is:
how do I simulate non-deterministic floats? how do I test for reachability of certain function calls?
nondet_float()is returning the contents of an uninitialized local variable. The result is undefined behavior. Suggest re-thinking, perhaps by usingsrand()andrand()to get a float value. - user3629249