Skip to content

Commit d456e8c

Browse files
committed
Field sensitivity for unions
Field-sensitive tracking of unions permits propagating constants even when those do not affect the full width of the union (implying that some bits remain non-constant).
1 parent 6d5902a commit d456e8c

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

regression/cbmc/union18/main.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#include <assert.h>
2+
3+
union u_type
4+
{
5+
int i;
6+
char ch;
7+
};
8+
9+
int main()
10+
{
11+
union u_type u;
12+
13+
u.ch = 2;
14+
assert(u.ch == 2);
15+
}

regression/cbmc/union18/test.desc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CORE
2+
main.c
3+
4+
^Generated 1 VCC\(s\), 0 remaining after simplification$
5+
^VERIFICATION SUCCESSFUL$
6+
^EXIT=0$
7+
^SIGNAL=0$
8+
--
9+
^warning: ignoring
10+
--
11+
This should be fully solved by constant propagation when union field-sensitivity
12+
is in place.

0 commit comments

Comments
 (0)