Closed chkl closed 5 years ago
extern void __VERIFIER_error() __attribute__((__noreturn__));
extern unsigned short __VERIFIER_nondet_ushort(void);
void __VERIFIER_assert(int cond)
{
if (!cond)
{
ERROR:
__VERIFIER_error();
}
return;
}
int main()
{
unsigned short x = __VERIFIER_nondet_ushort();
unsigned int i = 0;
while (i < sizeof(x) * 8)
{
__VERIFIER_assert((x & (1 << i)) != 6);
i++;
}
}
klee also says unsat (after defining the shim for __VERIFIER_nondet_ushort()).
I also believe that this is "unsat", because (1>>i) should always be a power of 2 or 0 and therefore that expression should always be 1 or 0.
EDIT: Not true, bit shifting by a number of bits that it is greater than the bitsize of the datatype is undefined behavior. So it actually is Sat.
@chkl Yes, that sounds right.
I have no idea what the correct answer is, but the verdicts are as follows: sea/ultimate : sat klee: unknown cbmc/smack/cpachecker: unsat