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

^EXIT=0$
Expand Down
2 changes: 1 addition & 1 deletion regression/cbmc/Anonymous_Struct3/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CORE
CORE new-smt-backend
main.c
-win32
^EXIT=0$
Expand Down
2 changes: 1 addition & 1 deletion regression/cbmc/Struct_Array1/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CORE
CORE new-smt-backend
main.c

^EXIT=0$
Expand Down
2 changes: 1 addition & 1 deletion regression/cbmc/Struct_Bytewise1/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CORE
CORE new-smt-backend
struct_bytewise.c

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

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

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

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

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

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

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

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

^EXIT=0$
Expand Down
2 changes: 1 addition & 1 deletion regression/cbmc/Struct_Initialization8/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FUTURE
CORE new-smt-backend
main.c

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

^EXIT=0$
Expand Down
2 changes: 1 addition & 1 deletion regression/cbmc/Struct_Padding1/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CORE
CORE new-smt-backend
main.i
--32
^EXIT=0$
Expand Down
2 changes: 1 addition & 1 deletion regression/cbmc/Struct_Pointer1/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CORE
CORE new-smt-backend
main.c

^EXIT=0$
Expand Down
2 changes: 1 addition & 1 deletion regression/cbmc/Struct_Pointer2/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CORE
CORE new-smt-backend
main.c
--pointer-check
^EXIT=0$
Expand Down
2 changes: 1 addition & 1 deletion regression/cbmc/Struct_Pointer3/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CORE
CORE new-smt-backend
main.c

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

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

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

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

^EXIT=0$
Expand Down
2 changes: 1 addition & 1 deletion regression/cbmc/struct12/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CORE
CORE new-smt-backend
main.c
--pointer-check --bounds-check
^EXIT=0$
Expand Down
2 changes: 1 addition & 1 deletion regression/cbmc/struct13/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CORE
CORE new-smt-backend
main.c

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

^EXIT=10$
Expand Down
2 changes: 1 addition & 1 deletion regression/cbmc/struct15/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CORE smt-backend
CORE smt-backend new-smt-backend
main.c
--trace --z3
^EXIT=0$
Copy link
Contributor Author

@NlightNFotis NlightNFotis Jul 18, 2023

Choose a reason for hiding this comment

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

Despite the --z3 flag here, this does run with the new SMT backend when the test.pl profile for the new-smt-backend is run.

I have verified this locally, but I'm not sure I understand why that is - I speculate that the handling for the --incremental-smt2-solver flag is earlier, and path dependence handles the rest, but I haven't looked too close.

Copy link
Collaborator

Choose a reason for hiding this comment

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

That matches my understanding. The --z3 flag is ignored when --incremental-smt2-solver is specified. Unfortunately the control flow for the solver_factory where this is handled is not always the easiest to follow.

Expand Down
2 changes: 1 addition & 1 deletion regression/cbmc/struct17/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CORE
CORE new-smt-backend
main.c

^VERIFICATION SUCCESSFUL$
Expand Down
2 changes: 1 addition & 1 deletion regression/cbmc/struct3/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CORE
CORE new-smt-backend
main.c

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

^EXIT=0$
Expand Down
2 changes: 1 addition & 1 deletion regression/cbmc/struct6/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CORE
CORE new-smt-backend
main.c
--bounds-check --pointer-check
^EXIT=0$
Expand Down
2 changes: 1 addition & 1 deletion regression/cbmc/struct7/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CORE
CORE new-smt-backend
main.c
--pointer-check --bounds-check
^EXIT=0$
Expand Down
2 changes: 1 addition & 1 deletion regression/cbmc/struct8/test.desc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CORE
CORE new-smt-backend
main.c

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

^EXIT=0$
Expand Down
Loading