Open danielsn opened 3 years ago
Having spoken to @danielsn:
1) The actual desired solution is to have ways to specify the addition as having wrap-around semantics. Similarly other built-ins may be required where the pragmas are really workarounds. 2) There should at least be a warning that this pragma will be ignored. 3) Supporting pragmas on all expressions is possible, but costly. Hence preferring 2) over this. 1) Should be covered by a separate effort.
Further failing example from @danielsn:
#include <assert.h>
int nondet_int();
void main() {
int a = nondet_int();
int b = nondet_int();
#pragma CPROVER check disable "signed-overflow"
for (int i = 0; i < 10; ++i) {
int temp = a + b;
#pragma CPROVER check pop
int foo = temp + a;
assert(foo > 2);
}
}
Edit: pragma
annotations are not sensitive to scopes, so there is nothing really wrong with the above.
It seems that it only applies at the statement level, but there is no warning given when compiling this with CBMC