@@ -40,12 +40,9 @@ void testArraySubscripts(int idx, int *p, int **pp) {
40
40
// expected-warning@-1{{'p' is an unsafe pointer used for buffer access}}
41
41
// expected-warning@-2{{'pp' is an unsafe pointer used for buffer access}}
42
42
foo (p[1 ], // expected-note{{used in buffer access here}}
43
- pp[1 ][1 ], // expected-note{{used in buffer access here}}
44
- // expected-warning@-1{{unsafe buffer access}}
45
- 1 [1 [pp]], // expected-note{{used in buffer access here}}
46
- // expected-warning@-1{{unsafe buffer access}}
47
- 1 [pp][1 ] // expected-note{{used in buffer access here}}
48
- // expected-warning@-1{{unsafe buffer access}}
43
+ pp[1 ][1 ], // expected-note2{{used in buffer access here}}
44
+ 1 [1 [pp]], // expected-note2{{used in buffer access here}}
45
+ 1 [pp][1 ] // expected-note2{{used in buffer access here}}
49
46
);
50
47
51
48
if (p[3 ]) { // expected-note{{used in buffer access here}}
@@ -65,13 +62,9 @@ void testArraySubscripts(int idx, int *p, int **pp) {
65
62
int b[10 ][10 ]; // expected-warning{{'b' is an unsafe buffer that does not perform bounds checks}}
66
63
67
64
foo (a[idx], idx[a], // expected-note2{{used in buffer access here}}
68
- b[idx][idx + 1 ], // expected-warning{{unsafe buffer access}}
69
- // expected-note@-1{{used in buffer access here}}
70
- (idx + 1 )[b][idx],// expected-warning{{unsafe buffer access}}
71
- // expected-note@-1{{used in buffer access here}}
72
- (idx + 1 )[idx[b]]);
73
- // expected-warning@-1{{unsafe buffer access}}
74
- // expected-note@-2{{used in buffer access here}}
65
+ b[idx][idx + 1 ], // expected-note2{{used in buffer access here}}
66
+ (idx + 1 )[b][idx],// expected-note2{{used in buffer access here}}
67
+ (idx + 1 )[idx[b]]); // expected-note2{{used in buffer access here}}
75
68
76
69
// Not to warn when index is zero
77
70
foo (p[0 ], pp[0 ][0 ], 0 [0 [pp]], 0 [pp][0 ],
@@ -108,8 +101,7 @@ void testQualifiedParameters(const int * p, const int * const q, const int a[10]
108
101
foo (p[1 ], 1 [p], p[-1 ], // expected-note3{{used in buffer access here}}
109
102
q[1 ], 1 [q], q[-1 ], // expected-note3{{used in buffer access here}}
110
103
a[1 ], // expected-note{{used in buffer access here}} `a` is of pointer type
111
- b[1 ][2 ] // expected-note{{used in buffer access here}} `b[1]` is of array type
112
- // expected-warning@-1{{unsafe buffer access}}
104
+ b[1 ][2 ] // expected-note2{{used in buffer access here}} `b[1]` is of array type
113
105
);
114
106
}
115
107
@@ -223,10 +215,9 @@ template<typename T, int N> T f(T t, T * pt, T a[N], T (&b)[N]) {
223
215
// expected-warning@-1{{'t' is an unsafe pointer used for buffer access}}
224
216
// expected-warning@-2{{'pt' is an unsafe pointer used for buffer access}}
225
217
// expected-warning@-3{{'a' is an unsafe pointer used for buffer access}}
226
- // expected-warning@-4{{'b' is an unsafe buffer that does not perform bounds checks}}
227
218
foo (pt[1 ], // expected-note{{used in buffer access here}}
228
219
a[1 ], // expected-note{{used in buffer access here}}
229
- b[1 ]); // expected-note{{used in buffer access here}}
220
+ b[1 ]);
230
221
return &t[1 ]; // expected-note{{used in buffer access here}}
231
222
}
232
223
@@ -366,17 +357,15 @@ int testArrayAccesses(int n, int idx) {
366
357
// expected-warning@-1{{'cArr' is an unsafe buffer that does not perform bounds checks}}
367
358
int d = cArr[0 ][0 ];
368
359
foo (cArr[0 ][0 ]);
369
- foo (cArr[idx][idx + 1 ]); // expected-note{{used in buffer access here}}
370
- // expected-warning@-1{{unsafe buffer access}}
371
- auto cPtr = cArr[idx][idx * 2 ]; // expected-note{{used in buffer access here}}
372
- // expected-warning@-1{{unsafe buffer access}}
360
+ foo (cArr[idx][idx + 1 ]); // expected-note2{{used in buffer access here}}
361
+ auto cPtr = cArr[idx][idx * 2 ]; // expected-note2{{used in buffer access here}}
373
362
foo (cPtr);
374
363
375
364
// Typdefs
376
365
typedef int A[3 ];
377
366
const A tArr = {4 , 5 , 6 };
378
367
foo (tArr[0 ], tArr[1 ]);
379
- return cArr[0 ][1 ]; // expected-warning{{unsafe buffer access}}
368
+ return cArr[0 ][1 ];
380
369
}
381
370
382
371
void testArrayPtrArithmetic (int x[]) { // expected-warning{{'x' is an unsafe pointer used for buffer access}}
0 commit comments