Skip to content

Commit eadb111

Browse files
committed
Add regression test for nested struct member
1 parent 7de085d commit eadb111

File tree

4 files changed

+37
-2
lines changed

4 files changed

+37
-2
lines changed

regression/cbmc/Struct_Initialization5/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE new-smt-backend
1+
CORE
22
main.c
33

44
^EXIT=0$
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
struct aux
2+
{
3+
char comment;
4+
};
5+
6+
struct expr
7+
{
8+
int line;
9+
struct aux *info;
10+
};
11+
12+
int main(void)
13+
{
14+
struct aux info1 = {'a'};
15+
struct aux info2 = {'b'};
16+
struct expr var_expr = {42, &info1};
17+
struct expr other_expr = {34, &info2};
18+
unsigned int nondet;
19+
char *ref;
20+
if(nondet)
21+
ref = &var_expr.info->comment;
22+
else
23+
ref = &other_expr.info->comment;
24+
__CPROVER_assert(*ref != 'b', "expected failure: ref == 'b'");
25+
return 0;
26+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE new-smt-backend
2+
address_of_rec.c
3+
4+
\[main\.assertion\.1\] line \d+ expected failure: ref == 'b': FAILURE
5+
^EXIT=10$
6+
^SIGNAL=0$
7+
^VERIFICATION FAILED$
8+
--
9+
--

regression/cbmc/struct16/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CORE new-smt-backend
1+
CORE
22
main.c
33

44
^VERIFICATION SUCCESSFUL$

0 commit comments

Comments
 (0)