File: reduce_index.i

package info (click to toggle)
frama-c 20161101%2Bsilicon%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 42,324 kB
  • ctags: 35,695
  • sloc: ml: 200,142; ansic: 31,465; makefile: 2,334; sh: 1,643; lisp: 259; python: 85; asm: 26
file content (145 lines) | stat: -rw-r--r-- 1,509 bytes parent folder | download | duplicates (6)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
int t[10];
int u[11];
volatile int maybe;
extern int c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12;

int f1_aux () {
  return 1;
}

void f1 () {
  t[c1]=f1_aux();
  c1 = c1;
}

int f2() {
  c2 = c2;
  return t[c2];
}

int f3() {
  t[c3];
  c3 = c3;
  return 0;
}

int f4() {
  if(t[c4]) {
    int x = 1;
  }
  c4 = c4;
  return 0;
}

int f5() {
  int c = t[c5];
  c5 = c5;
  return 0;
}


void f6() {
  u[c6] = t[c6];
  t[c6] = u[c6];
  c6 = c6;
}

void f7() {
  t[c7] = u[c7];
  u[c7] = t[c7];
  c7 = c7;
}

typedef struct {
  int f1;
  int f2;
} typs;

typs ts[10];
typs *p8;

int f8 () {
  p8 = &ts[c8];

  p8->f1 = 1;
  p8->f2 = 2;
  c8 = c8;
  p8 = p8;
  return 0;
}

int f9 () {
  ts[c9].f1 = 1;
  c9 = c9;
  return 0;
}


typedef int ti4[4];
typedef int ti7[7];

int ti_4[4];
int ti_7[7];

void f10 () {
  ti7* p7 = &ti_7;
  (*p7)[c10] = 10;
  c10 = c10;
}

void f11 () {
  ti4* p4 = &ti_4;
  ti7* p7 = (ti7*)p4;
  (*p7)[c11]=11;
  c11 = c11;
}

void f12 () {
  ti7* p7 = &ti_7;
  ti4* p4 = (ti4*)p7;
  (*p4)[c12]=12;
  c12 = c12;
}

extern int k1, k2, k3, k4;

void pointer_index(void)
{
  int *p = u;
  int l;
  l = p[k1];
  k1 = k1;
  p = (char*)u + 5;
  l = p[k2];
  k2 = k2;
  p = (char*)u + 11;
  l = p[k3];
  k3 = k3;
  p = u + 3;
  l = p[k4];
  k4 = k4;
}

extern int nulli;

void null_index(void) {
  *((int*)0+nulli) = 0;
}

void main () {
  f1();
  f2();
  f3();
  f4();
  f5();
  f6();
  f7();
  f8();
  f9();
  f10();
  f11();
  f12();

  pointer_index();
  if (maybe) null_index();
}