Skip to content

Commit d7dc902

Browse files
committed
Add test showing limitations of __CPROVER_w_ok
We do not currently have a good way of distinguishing lvalues from rvalues, and thus actually treat __CPROVER_w_ok and __CPROVER_r_ok the same. The test shows that this shouldn't always be done.
1 parent f75bc2f commit d7dc902

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

regression/cbmc/r_w_ok3/main.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#include <assert.h>
2+
3+
int main()
4+
{
5+
const char *str = "foobar";
6+
assert(!__CPROVER_w_ok(str, 6));
7+
assert(__CPROVER_r_ok(str, 6));
8+
}

regression/cbmc/r_w_ok3/test.desc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
KNOWNBUG
2+
main.c
3+
4+
^VERIFICATION FAILED$
5+
^EXIT=10$
6+
^SIGNAL=0$
7+
--
8+
^warning: ignoring
9+
--
10+
We currently do not distinguish __CPROVER_r_ok and __CPROVER_w_ok at the
11+
implementation level. To make a meaningful distinction we would need to have
12+
predicates about lvalues vs rvalues.

0 commit comments

Comments
 (0)