-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add regression test for nested struct member
- Loading branch information
1 parent
a7ff65a
commit 16b0492
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
regression/cbmc/address_of_struct_member_rec/address_of_rec.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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$ | ||
-- | ||
-- |