Skip to content

Commit 1aa34c6

Browse files
committed
Add a regression test covering casting pointers form integer values.
1 parent 136c6f5 commit 1aa34c6

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
int main()
2+
{
3+
int *p = (int *)4;
4+
__CPROVER_allocated_memory(4, sizeof(int));
5+
6+
__CPROVER_assert(p == 4, "p == 4: expected success");
7+
__CPROVER_assert(p != 0, "p != 0: expected success");
8+
9+
p = (int *)0x1020304;
10+
__CPROVER_assert(p == 0x1020304, "p == 0x1020304: expected success");
11+
__CPROVER_assert(p != 0, "p != 0: expected success");
12+
__CPROVER_assert(p == 0, "p != 0: expected failure");
13+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
CORE
2+
pointer_from_int.c
3+
--trace
4+
\[main\.assertion\.1\] line \d+ p == 4: expected success: SUCCESS
5+
\[main\.assertion\.2\] line \d+ p != 0: expected success: SUCCESS
6+
\[main\.assertion\.3\] line \d+ p == 0x1020304: expected success: SUCCESS
7+
\[main\.assertion\.4\] line \d+ p != 0: expected success: SUCCESS
8+
\[main\.assertion\.5\] line \d+ p != 0: expected failure: FAILURE
9+
^VERIFICATION FAILED$
10+
^EXIT=10$
11+
^SIGNAL=0$
12+
--
13+
--
14+
This test is covering basic conversion of pointer values to integers.
15+
It contains two such conversions, one of an integer in decimal form,
16+
and one of an integer in a hexadecimal form.

0 commit comments

Comments
 (0)