1 // RUN: %clang_analyze_cc1 -std=c++17 %s\
2 // RUN: -analyzer-checker=core,cplusplus,alpha.cplusplus.STLAlgorithmModeling,debug.DebugIteratorModeling,debug.ExprInspection\
3 // RUN: -analyzer-config aggressive-binary-operation-simplification=true\
4 // RUN: -verify
5
6 #include "Inputs/system-header-simulator-cxx.h"
7
8 void clang_analyzer_eval(bool);
9
10 template <typename Iterator>
11 long clang_analyzer_iterator_position(const Iterator&);
12
13 template <typename Iter> Iter return_any_iterator(const Iter &It);
14
test_find1(std::vector<int> V,int n)15 void test_find1(std::vector<int> V, int n) {
16 const auto i1 = return_any_iterator(V.begin());
17 const auto i2 = return_any_iterator(V.begin());
18
19 const auto i3 = std::find(i1, i2, n);
20
21 clang_analyzer_eval(i3 == i2); // expected-warning{{FALSE}}
22
23 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
24 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
25 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
26 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
27
28 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
29 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
30 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
31 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
32 }
33
test_find2(std::vector<int> V,int n)34 void test_find2(std::vector<int> V, int n) {
35 const auto i1 = return_any_iterator(V.begin());
36 const auto i2 = return_any_iterator(V.begin());
37
38 const auto i3 = std::find(std::execution::sequenced_policy(), i1, i2, n);
39
40 clang_analyzer_eval(i3 == i2); // expected-warning{{FALSE}}}
41
42 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
43 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
44 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
45 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
46
47 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
48 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
49 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
50 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
51 }
52
odd(int i)53 bool odd(int i) { return i % 2; }
54
test_find_if1(std::vector<int> V)55 void test_find_if1(std::vector<int> V) {
56 const auto i1 = return_any_iterator(V.begin());
57 const auto i2 = return_any_iterator(V.begin());
58
59 const auto i3 = std::find_if(i1, i2, odd);
60
61 clang_analyzer_eval(i3 == i2); // expected-warning{{FALSE}}}
62
63 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
64 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
65 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
66 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
67
68 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
69 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
70 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
71 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
72 }
73
test_find_if2(std::vector<int> V)74 void test_find_if2(std::vector<int> V) {
75 const auto i1 = return_any_iterator(V.begin());
76 const auto i2 = return_any_iterator(V.begin());
77
78 const auto i3 = std::find_if(std::execution::sequenced_policy(), i1, i2, odd);
79
80 clang_analyzer_eval(i3 == i2); // expected-warning{{FALSE}}}
81
82 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
83 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
84 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
85 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
86
87 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
88 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
89 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
90 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
91 }
92
test_find_if_not1(std::vector<int> V)93 void test_find_if_not1(std::vector<int> V) {
94 const auto i1 = return_any_iterator(V.begin());
95 const auto i2 = return_any_iterator(V.begin());
96
97 const auto i3 = std::find_if_not(i1, i2, odd);
98
99 clang_analyzer_eval(i3 == i2); // expected-warning{{FALSE}}}
100
101 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
102 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
103 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
104 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
105
106 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
107 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
108 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
109 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
110 }
111
test_find_if_not2(std::vector<int> V)112 void test_find_if_not2(std::vector<int> V) {
113 const auto i1 = return_any_iterator(V.begin());
114 const auto i2 = return_any_iterator(V.begin());
115
116 const auto i3 = std::find_if_not(std::execution::sequenced_policy(), i1, i2,
117 odd);
118
119 clang_analyzer_eval(i3 == i2); // expected-warning{{FALSE}}}
120
121 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
122 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
123 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
124 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
125
126 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
127 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
128 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
129 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
130 }
131
test_find_first_of1(std::vector<int> V1,std::vector<int> V2)132 void test_find_first_of1(std::vector<int> V1, std::vector<int> V2) {
133 const auto i1 = return_any_iterator(V1.begin());
134 const auto i2 = return_any_iterator(V1.begin());
135 const auto i3 = return_any_iterator(V2.begin());
136 const auto i4 = return_any_iterator(V2.begin());
137
138 const auto i5 = std::find_first_of(i1, i2, i3, i4);
139
140 clang_analyzer_eval(i5 == i2); // expected-warning{{FALSE}}}
141
142 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
143 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
144 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
145 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
146
147 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
148 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
149 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
150 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
151 }
152
test_find_first_of2(std::vector<int> V1,std::vector<int> V2)153 void test_find_first_of2(std::vector<int> V1, std::vector<int> V2) {
154 const auto i1 = return_any_iterator(V1.begin());
155 const auto i2 = return_any_iterator(V1.begin());
156 const auto i3 = return_any_iterator(V2.begin());
157 const auto i4 = return_any_iterator(V2.begin());
158
159 const auto i5 = std::find_first_of(std::execution::sequenced_policy(),
160 i1, i2, i3, i4);
161
162 clang_analyzer_eval(i5 == i2); // expected-warning{{FALSE}}}
163
164 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
165 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
166 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
167 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
168
169 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
170 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
171 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
172 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
173 }
174
test_find_first_of3(std::vector<int> V1,std::vector<int> V2)175 void test_find_first_of3(std::vector<int> V1, std::vector<int> V2) {
176 const auto i1 = return_any_iterator(V1.begin());
177 const auto i2 = return_any_iterator(V1.begin());
178 const auto i3 = return_any_iterator(V2.begin());
179 const auto i4 = return_any_iterator(V2.begin());
180
181 const auto i5 = std::find_first_of(i1, i2, i3, i4, odd);
182
183 clang_analyzer_eval(i5 == i2); // expected-warning{{FALSE}}}
184
185 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
186 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
187 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
188 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
189
190 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
191 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
192 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
193 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
194 }
195
test_find_first_of4(std::vector<int> V1,std::vector<int> V2)196 void test_find_first_of4(std::vector<int> V1, std::vector<int> V2) {
197 const auto i1 = return_any_iterator(V1.begin());
198 const auto i2 = return_any_iterator(V1.begin());
199 const auto i3 = return_any_iterator(V2.begin());
200 const auto i4 = return_any_iterator(V2.begin());
201
202 const auto i5 = std::find_first_of(std::execution::sequenced_policy(),
203 i1, i2, i3, i4, odd);
204
205 clang_analyzer_eval(i5 == i2); // expected-warning{{FALSE}}}
206
207 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
208 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
209 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
210 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
211
212 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
213 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
214 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
215 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
216 }
217
test_find_end1(std::vector<int> V1,std::vector<int> V2)218 void test_find_end1(std::vector<int> V1, std::vector<int> V2) {
219 const auto i1 = return_any_iterator(V1.begin());
220 const auto i2 = return_any_iterator(V1.begin());
221 const auto i3 = return_any_iterator(V2.begin());
222 const auto i4 = return_any_iterator(V2.begin());
223
224 const auto i5 = std::find_end(i1, i2, i3, i4);
225
226 clang_analyzer_eval(i5 == i2); // expected-warning{{FALSE}}}
227
228 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
229 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
230 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
231 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
232
233 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
234 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
235 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
236 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
237 }
238
test_find_end2(std::vector<int> V1,std::vector<int> V2)239 void test_find_end2(std::vector<int> V1, std::vector<int> V2) {
240 const auto i1 = return_any_iterator(V1.begin());
241 const auto i2 = return_any_iterator(V1.begin());
242 const auto i3 = return_any_iterator(V2.begin());
243 const auto i4 = return_any_iterator(V2.begin());
244
245 const auto i5 = std::find_end(std::execution::sequenced_policy(),
246 i1, i2, i3, i4);
247
248 clang_analyzer_eval(i5 == i2); // expected-warning{{FALSE}}}
249
250 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
251 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
252 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
253 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
254
255 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
256 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
257 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
258 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
259 }
260
test_find_end3(std::vector<int> V1,std::vector<int> V2)261 void test_find_end3(std::vector<int> V1, std::vector<int> V2) {
262 const auto i1 = return_any_iterator(V1.begin());
263 const auto i2 = return_any_iterator(V1.begin());
264 const auto i3 = return_any_iterator(V2.begin());
265 const auto i4 = return_any_iterator(V2.begin());
266
267 const auto i5 = std::find_end(i1, i2, i3, i4, odd);
268
269 clang_analyzer_eval(i5 == i2); // expected-warning{{FALSE}}}
270
271 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
272 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
273 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
274 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
275
276 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
277 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
278 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
279 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
280 }
281
test_find_end4(std::vector<int> V1,std::vector<int> V2)282 void test_find_end4(std::vector<int> V1, std::vector<int> V2) {
283 const auto i1 = return_any_iterator(V1.begin());
284 const auto i2 = return_any_iterator(V1.begin());
285 const auto i3 = return_any_iterator(V2.begin());
286 const auto i4 = return_any_iterator(V2.begin());
287
288 const auto i5 = std::find_end(std::execution::sequenced_policy(),
289 i1, i2, i3, i4, odd);
290
291 clang_analyzer_eval(i5 == i2); // expected-warning{{FALSE}}}
292
293 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
294 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
295 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
296 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
297
298 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
299 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
300 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
301 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
302 }
303
304 bool compare(int, int);
305
test_lower_bound1(std::vector<int> V,int n)306 void test_lower_bound1(std::vector<int> V, int n) {
307 const auto i1 = return_any_iterator(V.begin());
308 const auto i2 = return_any_iterator(V.begin());
309
310 const auto i3 = std::lower_bound(i1, i2, n);
311
312 clang_analyzer_eval(i3 == i2); // expected-warning{{FALSE}}}
313
314 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
315 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
316 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
317 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
318
319 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
320 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
321 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
322 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
323 }
324
test_lower_bound2(std::vector<int> V,int n)325 void test_lower_bound2(std::vector<int> V, int n) {
326 const auto i1 = return_any_iterator(V.begin());
327 const auto i2 = return_any_iterator(V.begin());
328
329 const auto i3 = std::lower_bound(i1, i2, n, compare);
330
331 clang_analyzer_eval(i3 == i2); // expected-warning{{FALSE}}}
332
333 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
334 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
335 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
336 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
337
338 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
339 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
340 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
341 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
342 }
343
test_upper_bound1(std::vector<int> V,int n)344 void test_upper_bound1(std::vector<int> V, int n) {
345 const auto i1 = return_any_iterator(V.begin());
346 const auto i2 = return_any_iterator(V.begin());
347
348 const auto i3 = std::upper_bound(i1, i2, n);
349
350 clang_analyzer_eval(i3 == i2); // expected-warning{{FALSE}}}
351
352 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
353 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
354 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
355 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
356
357 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
358 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
359 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
360 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
361 }
362
test_upper_bound2(std::vector<int> V,int n)363 void test_upper_bound2(std::vector<int> V, int n) {
364 const auto i1 = return_any_iterator(V.begin());
365 const auto i2 = return_any_iterator(V.begin());
366
367 const auto i3 = std::upper_bound(i1, i2, n, compare);
368
369 clang_analyzer_eval(i3 == i2); // expected-warning{{FALSE}}}
370
371 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
372 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
373 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
374 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
375
376 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
377 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
378 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
379 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
380 }
381
test_search1(std::vector<int> V1,std::vector<int> V2)382 void test_search1(std::vector<int> V1, std::vector<int> V2) {
383 const auto i1 = return_any_iterator(V1.begin());
384 const auto i2 = return_any_iterator(V1.begin());
385 const auto i3 = return_any_iterator(V2.begin());
386 const auto i4 = return_any_iterator(V2.begin());
387
388 const auto i5 = std::search(i1, i2, i3, i4);
389
390 clang_analyzer_eval(i5 == i2); // expected-warning{{FALSE}}}
391
392 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
393 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
394 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
395 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
396
397 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
398 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
399 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
400 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
401 }
402
test_search2(std::vector<int> V1,std::vector<int> V2)403 void test_search2(std::vector<int> V1, std::vector<int> V2) {
404 const auto i1 = return_any_iterator(V1.begin());
405 const auto i2 = return_any_iterator(V1.begin());
406 const auto i3 = return_any_iterator(V2.begin());
407 const auto i4 = return_any_iterator(V2.begin());
408
409 const auto i5 = std::search(std::execution::sequenced_policy(),
410 i1, i2, i3, i4);
411
412 clang_analyzer_eval(i5 == i2); // expected-warning{{FALSE}}}
413
414 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
415 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
416 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
417 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
418
419 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
420 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
421 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
422 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
423 }
424
test_search3(std::vector<int> V1,std::vector<int> V2)425 void test_search3(std::vector<int> V1, std::vector<int> V2) {
426 const auto i1 = return_any_iterator(V1.begin());
427 const auto i2 = return_any_iterator(V1.begin());
428 const auto i3 = return_any_iterator(V2.begin());
429 const auto i4 = return_any_iterator(V2.begin());
430
431 const auto i5 = std::search(i1, i2, i3, i4, odd);
432
433 clang_analyzer_eval(i5 == i2); // expected-warning{{FALSE}}}
434
435 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
436 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
437 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
438 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
439
440 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
441 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
442 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
443 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
444 }
445
test_search4(std::vector<int> V1,std::vector<int> V2)446 void test_search4(std::vector<int> V1, std::vector<int> V2) {
447 const auto i1 = return_any_iterator(V1.begin());
448 const auto i2 = return_any_iterator(V1.begin());
449 const auto i3 = return_any_iterator(V2.begin());
450 const auto i4 = return_any_iterator(V2.begin());
451
452 const auto i5 = std::search(std::execution::sequenced_policy(),
453 i1, i2, i3, i4, odd);
454
455 clang_analyzer_eval(i5 == i2); // expected-warning{{FALSE}}}
456
457 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
458 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
459 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
460 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
461
462 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
463 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
464 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
465 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
466 }
467
test_search5(std::vector<int> V1,std::vector<int> V2)468 void test_search5(std::vector<int> V1, std::vector<int> V2) {
469 const auto i1 = return_any_iterator(V1.begin());
470 const auto i2 = return_any_iterator(V1.begin());
471 const auto i3 = return_any_iterator(V2.begin());
472 const auto i4 = return_any_iterator(V2.begin());
473
474 const auto i5 = std::search(i1, i2, std::default_searcher(i3, i4));
475
476 clang_analyzer_eval(i5 == i2); // expected-warning{{FALSE}}}
477
478 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
479 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
480 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
481 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
482
483 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
484 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
485 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
486 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
487 }
488
test_search_n1(std::vector<int> V,int n)489 void test_search_n1(std::vector<int> V, int n) {
490 const auto i1 = return_any_iterator(V.begin());
491 const auto i2 = return_any_iterator(V.begin());
492
493 const auto i3 = std::search_n(i1, i2, 2, n);
494
495 clang_analyzer_eval(i3 == i2); // expected-warning{{FALSE}}}
496
497 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
498 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
499 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
500 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
501
502 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
503 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
504 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
505 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
506 }
507
test_search_n2(std::vector<int> V,int n)508 void test_search_n2(std::vector<int> V, int n) {
509 const auto i1 = return_any_iterator(V.begin());
510 const auto i2 = return_any_iterator(V.begin());
511
512 const auto i3 = std::search_n(std::execution::sequenced_policy(),
513 i1, i2, 2, n);
514
515 clang_analyzer_eval(i3 == i2); // expected-warning{{FALSE}}}
516
517
518 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
519 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
520 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
521 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
522
523 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
524 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
525 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
526 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
527 }
528
test_search_n3(std::vector<int> V,int n)529 void test_search_n3(std::vector<int> V, int n) {
530 const auto i1 = return_any_iterator(V.begin());
531 const auto i2 = return_any_iterator(V.begin());
532
533 const auto i3 = std::search_n(i1, i2, 2, n, compare);
534
535 clang_analyzer_eval(i3 == i2); // expected-warning{{FALSE}}}
536
537 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
538 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
539 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
540 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
541
542 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
543 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
544 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
545 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
546 }
547
test_search_n4(std::vector<int> V,int n)548 void test_search_n4(std::vector<int> V, int n) {
549 const auto i1 = return_any_iterator(V.begin());
550 const auto i2 = return_any_iterator(V.begin());
551
552 const auto i3 = std::search_n(std::execution::sequenced_policy(),
553 i1, i2, 2, n, compare);
554
555 clang_analyzer_eval(i3 == i2); // expected-warning{{FALSE}}}
556
557 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
558 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
559 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
560 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
561
562 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
563 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
564 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
565 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
566 }
567