struct_assignment: use assigned expression
[smatch.git] / validation / linear / unexamined-base-type.c
blob142139a2e4114267253510a94112b62af6371f05
1 # define __force __attribute__((force))
3 struct s {
4 int a;
5 };
7 static int foo(struct s *s)
9 return (*((typeof(s->a) __force *) &s->a)) & 1;
12 static void bar(struct s *d, struct s *s1, struct s *s2)
14 *d = *s1, *d = *s2;
18 * check-name: unexamined base type
19 * check-command: test-linearize -Wno-decl $file
20 * check-description:
21 * Test case for missing examine in evaluate_dereference()'s
22 * target base type. In this case, the loaded value has a
23 * a null size, giving the wrongly generated code for foo():
24 * ptrcast.64 %r3 <- (64) %arg1
25 * load %r4 <- 0[%r3]
26 * ^^^ !! WRONG !!
27 * cast.32 %r5 <- (0) %r4
28 * ^^^ !! WRONG !!
29 * and.32 %r6 <- %r5, $1
30 * ret.32 %r6
32 * check-output-ignore
33 * check-output-excludes: load[^.]
34 * check-output-excludes: cast\\..*(0)
35 * check-output-excludes: store[^.]