Skip to content

Commit 1c52e3c

Browse files
authored
Merge pull request #7855 from tautschnig/bugfixes/byte-update-members
Fix byte update of struct/array elements
2 parents 8c6f963 + 5e907b0 commit 1c52e3c

File tree

3 files changed

+278
-194
lines changed

3 files changed

+278
-194
lines changed

regression/cbmc/byte_update18/main.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
struct S
2+
{
3+
unsigned char A[1];
4+
char len; // keep this to reproduce
5+
};
6+
7+
struct O
8+
{
9+
struct S A[2];
10+
char len; // this is key to reproduce
11+
};
12+
13+
int main()
14+
{
15+
struct O t = {{{{0}, 2}, {{42}, 2}}, 2};
16+
unsigned n;
17+
__CPROVER_assume(n < 2);
18+
__CPROVER_assume(n > 0);
19+
char src_n[n];
20+
__CPROVER_array_replace((char *)t.A[0].A, src_n);
21+
__CPROVER_assert(t.A[1].A[0] == 42, "");
22+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
CORE broken-cprover-smt-backend
2+
main.c
3+
4+
^VERIFICATION SUCCESSFUL$
5+
^EXIT=0$
6+
^SIGNAL=0$
7+
--
8+
^warning: ignoring
9+
--
10+
Some bug in our in-tree SMT2 solver makes it report SAT, when Z3 states that the
11+
same SMT2 formula is (as expected) UNSAT.

0 commit comments

Comments
 (0)