Skip to content

Commit

Permalink
Add test for address of member
Browse files Browse the repository at this point in the history
  • Loading branch information
NlightNFotis committed Oct 6, 2023
1 parent de9340c commit 7de085d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
19 changes: 19 additions & 0 deletions regression/cbmc/address_of_struct_member/address_of.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
struct expr
{
int line;
char comment;
};

int main(int argc, char *argv[])
{
struct expr var_expr = {42, 'a'};
struct expr other_expr = {34, 'b'};
unsigned int nondet;
int *ref;
if(nondet)
ref = &var_expr.line;
else
ref = &other_expr.line;
__CPROVER_assert(*ref != 34, "expected failure: ref == 34");
return 0;
}
9 changes: 9 additions & 0 deletions regression/cbmc/address_of_struct_member/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CORE new-smt-backend
address_of.c

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

0 comments on commit 7de085d

Please sign in to comment.