Skip to content

Commit e5f91f2

Browse files
committed
Add regression test for __CPROVER_POINTER_OFFSET
1 parent e2dca8a commit e5f91f2

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
int main()
2+
{
3+
int a;
4+
int *p = &a;
5+
int *q = &a;
6+
7+
__CPROVER_assert(
8+
__CPROVER_POINTER_OFFSET(p) != __CPROVER_POINTER_OFFSET(q),
9+
"expected failure because offsets should be the same");
10+
11+
// TODO: Remove comments once pointer arithmetic works:
12+
13+
// *q = p + 2;
14+
15+
// __CPROVER_assert(__CPROVER_POINTER_OFFSET(p) != __CPROVER_POINTER_OFFSET(q), "expected failure");
16+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
CORE
2+
pointer_offset.c
3+
--trace
4+
\[main\.assertion\.1\] line \d+ expected failure because offsets should be the same: FAILURE
5+
^VERIFICATION FAILED$
6+
^EXIT=10$
7+
^SIGNAL=0$
8+
--
9+
--
10+
Test that the pointer offset bits of two pointers pointing to
11+
the same object are equal.
12+
13+
The test also contains a fragment of the test which doesn't work
14+
for now, but would be good to be added as soon as we get pointer
15+
arithmetic to work, so we can make sure that pointer offset fails
16+
appropriately.

0 commit comments

Comments
 (0)