File: struct3.i

package info (click to toggle)
frama-c 20220511-manganese-5
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 66,492 kB
  • sloc: ml: 278,834; ansic: 47,093; sh: 4,823; makefile: 3,613; javascript: 2,436; python: 1,919; perl: 897; lisp: 293; xml: 62
file content (47 lines) | stat: -rw-r--r-- 683 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* run.config*
   STDOPT: +"-eva-warn-key garbled-mix"
*/

struct st1 {
 int a;
 int *b;
};

struct st2 {
 int a;
 int d[10];
 struct st1 b;
 struct st1 e[10];
 struct st2 *c;
};

struct st1 tabst[10], tabst2[10];

struct st2 tab_s[2];
struct st2 tab_s1[2];
struct st2 tab_s2[2];
struct st2 tab_s3[2];
struct st2 tab_s4[2];

struct st2 s1,s2;
struct st1 s8,s7;

volatile int v;

void main () {
  s1.a=2;
  s1.c = &s1;
  s1.d[0] = 1;
  s1.d[1] = 2;
  s1.d[2] = 2;

  s1.b.a = 3;
  s1.d[8] = 2;
  s1.d[9] = 2;

  if (v) s1.d[10] = 2;

  s2 = s1; // Creates a garbled mix internally; make sure not to log it

  s2.a = (int) (s2.c + (int) s2.c); // creates a garbled mix in the struct
}