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 Oct 6, 2023
1 parent 7de085d commit eadb111
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 2 deletions.
2 changes: 1 addition & 1 deletion regression/cbmc/Struct_Initialization5/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CORE new-smt-backend
CORE
main.c

^EXIT=0$
Expand Down
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$
--
--
2 changes: 1 addition & 1 deletion regression/cbmc/struct16/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CORE new-smt-backend
CORE
main.c

^VERIFICATION SUCCESSFUL$
Expand Down

0 comments on commit eadb111

Please sign in to comment.