blob: ccf8fe392bfa867952944a6c0768cb2e194022e9 (
plain)
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
|
#include "analyzer-decls.h"
struct coord
{
int x;
int y;
};
/* Copying from one on-stack array to another. */
void test_1 (void)
{
struct coord arr_a[16];
struct coord arr_b[16];
arr_a[3].x = 5;
arr_a[3].y = 6;
arr_b[7] = arr_a[3];
__analyzer_eval (arr_b[7].x == 5); /* { dg-warning "TRUE" } */
__analyzer_eval (arr_b[7].y == 6); /* { dg-warning "TRUE" } */
}
/* Copying from an on-stack array to a global array. */
struct coord glob_arr[16];
void test_2 (void)
{
struct coord arr[16];
arr[3].x = 5;
arr[3].y = 6;
glob_arr[7] = arr[3];
__analyzer_eval (glob_arr[7].x == 5); /* { dg-warning "TRUE" } */
__analyzer_eval (glob_arr[7].y == 6); /* { dg-warning "TRUE" } */
}
/* Copying from a partially initialized on-stack array to a global array. */
struct coord glob_arr[16];
void test_3 (void)
{
struct coord arr[16];
arr[3].y = 6;
glob_arr[7] = arr[3]; // or should the uninit warning be here?
__analyzer_eval (glob_arr[7].x); /* { dg-warning "uninitialized" "uninit" { xfail *-*-* } } */
/* { dg-bogus "UNKNOWN" "unknown" { xfail *-*-* } .-1 } */
__analyzer_eval (glob_arr[7].y == 6); /* { dg-warning "TRUE" } */
}
/* Symbolic bindings: copying from one array to another. */
struct coord glob_arr[16];
void test_4 (int i)
{
struct coord arr_a[16];
struct coord arr_b[16];
arr_a[i].x = 5;
arr_a[i].y = 6;
__analyzer_eval (arr_a[i].x == 5); /* { dg-warning "TRUE" "TRUE" { xfail *-*-* } } */
/* { dg-bogus "UNKNOWN" "UNKNOWN" { xfail *-*-* } .-1 } */
__analyzer_eval (arr_a[i].y == 6); /* { dg-warning "TRUE" } */
arr_b[i] = arr_a[i];
__analyzer_eval (arr_b[i].x == 5); /* { dg-warning "TRUE" "TRUE" { xfail *-*-* } } */
/* { dg-bogus "UNKNOWN" "UNKNOWN" { xfail *-*-* } .-1 } */
__analyzer_eval (arr_b[i].y == 6); /* { dg-warning "TRUE" "TRUE" { xfail *-*-* } } */
/* { dg-bogus "UNKNOWN" "UNKNOWN" { xfail *-*-* } .-1 } */
}
/* Symbolic bindings: copying within an array: symbolic src and dest */
struct coord glob_arr[16];
void test_5a (int i, int j)
{
struct coord arr[16];
arr[i].x = 5;
arr[i].y = 6;
arr[j] = arr[i];
__analyzer_eval (arr[j].x == 5); /* { dg-warning "TRUE" "TRUE" { xfail *-*-* } } */
/* { dg-bogus "UNKNOWN" "UNKNOWN" { xfail *-*-* } .-1 } */
__analyzer_eval (arr[j].y == 6); /* { dg-warning "TRUE" "TRUE" { xfail *-*-* } } */
/* { dg-bogus "UNKNOWN" "UNKNOWN" { xfail *-*-* } .-1 } */
}
/* Symbolic bindings: copying within an array: symbolic src, concrete dest. */
struct coord glob_arr[16];
void test_5b (int i)
{
struct coord arr[16];
arr[i].x = 5;
arr[i].y = 6;
arr[3] = arr[i];
__analyzer_eval (arr[3].x == 5); /* { dg-warning "TRUE" "TRUE" { xfail *-*-* } } */
/* { dg-bogus "UNKNOWN" "UNKNOWN" { xfail *-*-* } .-1 } */
__analyzer_eval (arr[3].y == 6); /* { dg-warning "TRUE" "TRUE" { xfail *-*-* } } */
/* { dg-bogus "UNKNOWN" "UNKNOWN" { xfail *-*-* } .-1 } */
}
/* Symbolic bindings: copying within an array: concrete src, symbolic dest. */
struct coord glob_arr[16];
void test_5c (int i)
{
struct coord arr[16];
arr[3].x = 5;
arr[3].y = 6;
arr[i] = arr[3];
__analyzer_eval (arr[i].x == 5); /* { dg-warning "TRUE" "TRUE" { xfail *-*-* } } */
/* { dg-bogus "UNKNOWN" "UNKNOWN" { xfail *-*-* } .-1 } */
__analyzer_eval (arr[i].y == 6); /* { dg-warning "TRUE" "TRUE" { xfail *-*-* } } */
/* { dg-bogus "UNKNOWN" "UNKNOWN" { xfail *-*-* } .-1 } */
}
/* No info on the subregion being copied, and hence
binding_cluster2::maybe_get_compound_binding should return NULL. */
void test_6 (void)
{
struct coord arr[16];
arr[7] = glob_arr[3];
__analyzer_eval (arr[7].x == 5); /* { dg-warning "UNKNOWN" } */
__analyzer_eval (arr[7].y == 6); /* { dg-warning "UNKNOWN" } */
}
|