-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathtest.c
More file actions
98 lines (80 loc) · 1.39 KB
/
test.c
File metadata and controls
98 lines (80 loc) · 1.39 KB
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
int test(int x, int w, int z) {
int j;
long y = 50;
// if-else, multiple statements in block
if (x > 0) {
y = 20;
z = 10;
} else {
y = 30;
}
z = x + y;
// if-else with return in one branch
if(x < 0)
y = 40;
else
return z;
// this is not the start of a BB due to the return
z = 10;
// single-branch if-else
if (x == 0) {
y = 60;
z = 10;
}
z += x;
// while loop
while(x > 0) {
y = 10;
x--;
}
z += y;
// for loop
for(j = 0; j < 10; j++) {
y = 0;
w = 10;
}
z += w;
// nested control flow
for(j = 0; j < 10; j++) {
y = 30;
if(z > 0)
if(y > 0) {
w = 0;
break;
} else {
w = 20;
}
else {
w = 10;
continue;
}
x = 0;
}
z += x + y + w;
// nested control-flow
w = 40;
return w;
}
void test2(int a) {
/* Some more complex flow control */
int b, c;
for (;;) {
b = 10;
if (a > 100) {
c = 10;
b = c;
}
if (a == 10)
break;
if (a == 20)
return c;
}
return b;
}
void partly_undefined(int cond) {
int x;
if (cond) {
x = 1;
}
use(x);
}