-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtest.c
79 lines (62 loc) · 1.06 KB
/
test.c
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
#include <stdio.h>
void dummy(int *x) {}
void simple(void)
{
int x;
int y = x + 1;
}
void unsure(void)
{
int x;
int z = x;
dummy(&x);
int y = x + 1;
}
void paths(void)
{
int x;
int y = 0;
while (y == 1) {
x = 3;
}
y += x;
}
void paths_unsure(void)
{
int x;
int y = 0;
while (y == 1) {
dummy(&x);
}
y += x;
}
void paths_unsure_multi(void)
{
int x;
int y = 0;
if (y == 1) {
dummy(&x);
}
dummy(&x);
y += x;
}
// this code causes a bug where an "UNSURE" is reported, but there is an
// alternate path the is a "SURE". this may occur when the graph traversal
// encounters a call -> load before the alternative path which goes straight
// from alloca to load. this is fundamentally caused by the fact that the
// traversal visits each basic block exactly once.
void paths_mislabeling(void)
{
int x;
int y = 0;
if (y == 1) {
int z;
} else {
dummy(&x);
}
y += x;
}
int main(int argc, const char **argv)
{
return 0;
}