Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable all struct tests under regression/cbmc/ for new SMT backend #7809

Merged
merged 3 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⛏️ I am not sure this is a great test of the new SMT back end. The line field of expr will be at offset zero. It would be good to include taking the address of a field with a non-zero offset such as the comment field and to check that the resulting size of the offset is as expected.

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$
--
--