Skip to content

Commit 3251ce4

Browse files
author
Enrico Steffinlongo
committed
Add regressions for shadow memory BV aggregation
1 parent 9e1c895 commit 3251ce4

File tree

4 files changed

+56
-0
lines changed

4 files changed

+56
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#include <assert.h>
2+
3+
int main()
4+
{
5+
__CPROVER_field_decl_local("uninitialized", (char)0);
6+
__CPROVER_field_decl_global("uninitialized", (char)0);
7+
8+
int i;
9+
char *a = &i;
10+
11+
__CPROVER_set_field(a + 1, "uninitialized", 1);
12+
13+
assert(__CPROVER_get_field(a, "uninitialized") == 0);
14+
assert(__CPROVER_get_field(&i, "uninitialized") == 1);
15+
assert(__CPROVER_get_field(a + 1, "uninitialized") == 1);
16+
// Expecting the remaining bytes to be untouched by the setting of the field.
17+
assert(__CPROVER_get_field(a + 2, "uninitialized") == 0);
18+
assert(__CPROVER_get_field(a + 3, "uninitialized") == 0);
19+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
main.c
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
8+
^warning: ignoring
9+
--
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#include <assert.h>
2+
3+
int main()
4+
{
5+
__CPROVER_field_decl_local("uninitialized", (_Bool)0);
6+
__CPROVER_field_decl_global("uninitialized", (_Bool)0);
7+
8+
int i;
9+
char *a = &i;
10+
11+
__CPROVER_set_field(a + 1, "uninitialized", 1);
12+
13+
assert(__CPROVER_get_field(a, "uninitialized") == 0);
14+
assert(__CPROVER_get_field(a + 1, "uninitialized") == 1);
15+
assert(__CPROVER_get_field(&i, "uninitialized") == 1);
16+
// Expecting the remaining bytes to be untouched by the setting of the field.
17+
assert(__CPROVER_get_field(a + 2, "uninitialized") == 0);
18+
assert(__CPROVER_get_field(a + 3, "uninitialized") == 0);
19+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
main.c
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
8+
^warning: ignoring
9+
--

0 commit comments

Comments
 (0)