You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Dereferencing a larger bit-width pointer is not caught by property checks (was: CBMC fails to prove trivial inverse square root floating point property) #7640
I run cbmc on the code attached (part of my graphic library) that should be SAFE.
However cbmc returns assertion Q_rsqrt(f) > 0: FAILURE.
Why?
#include<assert.h>#include<math.h>floatnondet_float (void);
floatQ_rsqrt( floatnumber )
{
longi;
floatx2, y;
constfloatthreehalfs=1.5F;
x2=number*0.5F;
y=number;
i=* ( long* ) &y;
i=0x5f3759df- ( i >> 1 );
y=* ( float* ) &i;
y=y* ( threehalfs- ( x2*y*y ) );
returny;
}
intmain (void) {
floatf=nondet_float();
// Everything in this range hits the bug__CPROVER_assume(f<+INFINITY);
__CPROVER_assume(f>0.0f);
// Should pass ass 1/sqrt(f) is always > 0 when f > 0assert(Q_rsqrt(f) >0);
return1;
}
CBMC version: 5.80
Operating system: MacOS
Exact command line resulting in the issue: cbmc main.c
What behaviour did you expect: Verification SUCCESS
What happened instead: Verification FAILURE