Skip to content

Commit

Permalink
Add regression test for nested struct member
Browse files Browse the repository at this point in the history
  • Loading branch information
NlightNFotis committed Jul 18, 2023
1 parent a7ff65a commit 16b0492
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
26 changes: 26 additions & 0 deletions regression/cbmc/address_of_struct_member_rec/address_of_rec.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
struct aux
{
char comment;
};

struct expr
{
int line;
struct aux *info;
};

int main(void)
{
struct aux info1 = {'a'};
struct aux info2 = {'b'};
struct expr var_expr = {42, &info1};
struct expr other_expr = {34, &info2};
unsigned int nondet;
char *ref;
if(nondet)
ref = &var_expr.info->comment;
else
ref = &other_expr.info->comment;
__CPROVER_assert(*ref != 'b', "expected failure: ref == 'b'");
return 0;
}
9 changes: 9 additions & 0 deletions regression/cbmc/address_of_struct_member_rec/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CORE new-smt-backend
address_of_rec.c

\[main\.assertion\.1\] line \d+ expected failure: ref == 'b': FAILURE
^EXIT=10$
^SIGNAL=0$
^VERIFICATION FAILED$
--
--

0 comments on commit 16b0492

Please sign in to comment.