Skip to content

added a test for the precision of the value sets on unions #2854

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

Merged
merged 1 commit into from
Sep 4, 2018
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
31 changes: 31 additions & 0 deletions regression/cbmc/union10/union_list2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include <assert.h>

struct list_item
{
unsigned value;
struct list_item *previous;
};

struct List
{
unsigned something;
struct list_item * index, end;
};

union U
{
struct List my_list;
};

int main()
{
union U u;

u.my_list.index = &u.my_list.end;
struct list_item *p0 = u.my_list.index;
u.my_list.end.value = 123;
u.my_list.end.previous = u.my_list.index;
struct list_item *p1 = u.my_list.index;
struct list_item *p2 = p1->previous;
assert(p2 != 0); // should pass
}
18 changes: 18 additions & 0 deletions regression/cbmc/union10/union_list2.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
KNOWNBUG
union_list2.c

^EXIT=0$
^SIGNAL=0$
^VERIFICATION SUCCESSFUL$
--
^warning: ignoring
--
Value sets do not record byte-extract operations with sufficient detail:
struct list_item *p1 = u.my_list.index;
struct list_item *p2 = p1->previous;
yields
(29) p1!0@1#2 == byte_extract_little_endian(u!0@1#4, 8l, struct list_item { unsigned int value; unsigned int $pad1; struct list_item *previous; } *)
(30) p2!0@1#2 == p1$object#0.previous
as
main::1::p1 = { <integer_address, *, unsigned char> }
is the only information stored in the value set.