Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Analysis / stl-algorithm-modeling-aggressive-std-find-modeling.cpp
blob98301cf7274fc85cdf98935283b1a39c1314fc91
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: -analyzer-config alpha.cplusplus.STLAlgorithmModeling:AggressiveStdFindModeling=true\
5 // RUN: -verify
7 #include "Inputs/system-header-simulator-cxx.h"
9 void clang_analyzer_eval(bool);
11 template <typename Iterator>
12 long clang_analyzer_iterator_position(const Iterator&);
14 template <typename Iter> Iter return_any_iterator(const Iter &It);
16 void test_find1(std::vector<int> V, int n) {
17 const auto i1 = return_any_iterator(V.begin());
18 const auto i2 = return_any_iterator(V.begin());
20 const auto i3 = std::find(i1, i2, n);
22 clang_analyzer_eval(i3 == i2); // expected-warning{{TRUE}} expected-warning{{FALSE}}
24 if (i3 != i2) {
25 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
26 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
27 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
28 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
30 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
31 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
32 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
33 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
37 void test_find2(std::vector<int> V, int n) {
38 const auto i1 = return_any_iterator(V.begin());
39 const auto i2 = return_any_iterator(V.begin());
41 const auto i3 = std::find(std::execution::sequenced_policy(), i1, i2, n);
43 clang_analyzer_eval(i3 == i2); // expected-warning{{TRUE}} expected-warning{{FALSE}}
45 if (i3 != i2) {
46 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
47 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
48 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
49 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
51 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
52 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
53 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
54 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
58 bool odd(int i) { return i % 2; }
60 void test_find_if1(std::vector<int> V) {
61 const auto i1 = return_any_iterator(V.begin());
62 const auto i2 = return_any_iterator(V.begin());
64 const auto i3 = std::find_if(i1, i2, odd);
66 clang_analyzer_eval(i3 == i2); // expected-warning{{TRUE}} expected-warning{{FALSE}}
68 if (i3 != i2) {
69 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
70 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
71 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
72 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
74 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
75 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
76 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
77 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
81 void test_find_if2(std::vector<int> V) {
82 const auto i1 = return_any_iterator(V.begin());
83 const auto i2 = return_any_iterator(V.begin());
85 const auto i3 = std::find_if(std::execution::sequenced_policy(), i1, i2, odd);
87 clang_analyzer_eval(i3 == i2); // expected-warning{{TRUE}} expected-warning{{FALSE}}
89 if (i3 != i2) {
90 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
91 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
92 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
93 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
95 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
96 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
97 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
98 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
102 void test_find_if_not1(std::vector<int> V) {
103 const auto i1 = return_any_iterator(V.begin());
104 const auto i2 = return_any_iterator(V.begin());
106 const auto i3 = std::find_if_not(i1, i2, odd);
108 clang_analyzer_eval(i3 == i2); // expected-warning{{TRUE}} expected-warning{{FALSE}}
110 if (i3 != i2) {
111 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
112 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
113 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
114 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
116 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
117 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
118 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
119 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
123 void test_find_if_not2(std::vector<int> V) {
124 const auto i1 = return_any_iterator(V.begin());
125 const auto i2 = return_any_iterator(V.begin());
127 const auto i3 = std::find_if_not(std::execution::sequenced_policy(), i1, i2,
128 odd);
130 clang_analyzer_eval(i3 == i2); // expected-warning{{TRUE}} expected-warning{{FALSE}}
132 if (i3 != i2) {
133 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
134 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
135 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
136 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
138 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
139 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
140 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
141 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
145 void test_find_first_of1(std::vector<int> V1, std::vector<int> V2) {
146 const auto i1 = return_any_iterator(V1.begin());
147 const auto i2 = return_any_iterator(V1.begin());
148 const auto i3 = return_any_iterator(V2.begin());
149 const auto i4 = return_any_iterator(V2.begin());
151 const auto i5 = std::find_first_of(i1, i2, i3, i4);
153 clang_analyzer_eval(i5 == i2); // expected-warning{{TRUE}} expected-warning{{FALSE}}
155 if (i5 != i2) {
156 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
157 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
158 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
159 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
161 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
162 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
163 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
164 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
168 void test_find_first_of2(std::vector<int> V1, std::vector<int> V2) {
169 const auto i1 = return_any_iterator(V1.begin());
170 const auto i2 = return_any_iterator(V1.begin());
171 const auto i3 = return_any_iterator(V2.begin());
172 const auto i4 = return_any_iterator(V2.begin());
174 const auto i5 = std::find_first_of(std::execution::sequenced_policy(),
175 i1, i2, i3, i4);
177 clang_analyzer_eval(i5 == i2); // expected-warning{{TRUE}} expected-warning{{FALSE}}
179 if (i5 != i2) {
180 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
181 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
182 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
183 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
185 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
186 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
187 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
188 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
192 void test_find_first_of3(std::vector<int> V1, std::vector<int> V2) {
193 const auto i1 = return_any_iterator(V1.begin());
194 const auto i2 = return_any_iterator(V1.begin());
195 const auto i3 = return_any_iterator(V2.begin());
196 const auto i4 = return_any_iterator(V2.begin());
198 const auto i5 = std::find_first_of(i1, i2, i3, i4, odd);
200 clang_analyzer_eval(i5 == i2); // expected-warning{{TRUE}} expected-warning{{FALSE}}
202 if (i5 != i2) {
203 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
204 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
205 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
206 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
208 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
209 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
210 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
211 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
215 void test_find_first_of4(std::vector<int> V1, std::vector<int> V2) {
216 const auto i1 = return_any_iterator(V1.begin());
217 const auto i2 = return_any_iterator(V1.begin());
218 const auto i3 = return_any_iterator(V2.begin());
219 const auto i4 = return_any_iterator(V2.begin());
221 const auto i5 = std::find_first_of(std::execution::sequenced_policy(),
222 i1, i2, i3, i4, odd);
224 clang_analyzer_eval(i5 == i2); // expected-warning{{TRUE}} expected-warning{{FALSE}}
226 if (i5 != i2) {
227 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
228 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
229 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
230 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
232 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
233 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
234 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
235 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
239 void test_find_end1(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());
245 const auto i5 = std::find_end(i1, i2, i3, i4);
247 clang_analyzer_eval(i5 == i2); // expected-warning{{TRUE}} expected-warning{{FALSE}}
249 if (i5 != i2) {
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}}
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}}
262 void test_find_end2(std::vector<int> V1, std::vector<int> V2) {
263 const auto i1 = return_any_iterator(V1.begin());
264 const auto i2 = return_any_iterator(V1.begin());
265 const auto i3 = return_any_iterator(V2.begin());
266 const auto i4 = return_any_iterator(V2.begin());
268 const auto i5 = std::find_end(std::execution::sequenced_policy(),
269 i1, i2, i3, i4);
271 clang_analyzer_eval(i5 == i2); // expected-warning{{TRUE}} expected-warning{{FALSE}}
273 if (i5 != i2) {
274 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
275 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
276 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
277 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
279 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
280 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
281 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
282 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
286 void test_find_end3(std::vector<int> V1, std::vector<int> V2) {
287 const auto i1 = return_any_iterator(V1.begin());
288 const auto i2 = return_any_iterator(V1.begin());
289 const auto i3 = return_any_iterator(V2.begin());
290 const auto i4 = return_any_iterator(V2.begin());
292 const auto i5 = std::find_end(i1, i2, i3, i4, odd);
294 clang_analyzer_eval(i5 == i2); // expected-warning{{TRUE}} expected-warning{{FALSE}}
296 if (i5 != i2) {
297 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
298 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
299 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
300 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
302 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
303 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
304 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
305 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
309 void test_find_end4(std::vector<int> V1, std::vector<int> V2) {
310 const auto i1 = return_any_iterator(V1.begin());
311 const auto i2 = return_any_iterator(V1.begin());
312 const auto i3 = return_any_iterator(V2.begin());
313 const auto i4 = return_any_iterator(V2.begin());
315 const auto i5 = std::find_end(std::execution::sequenced_policy(),
316 i1, i2, i3, i4, odd);
318 clang_analyzer_eval(i5 == i2); // expected-warning{{TRUE}} expected-warning{{FALSE}}
320 if (i5 != i2) {
321 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
322 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
323 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
324 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
326 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
327 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
328 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
329 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
333 bool compare(int, int);
335 void test_lower_bound1(std::vector<int> V, int n) {
336 const auto i1 = return_any_iterator(V.begin());
337 const auto i2 = return_any_iterator(V.begin());
339 const auto i3 = std::lower_bound(i1, i2, n);
341 clang_analyzer_eval(i3 == i2); // expected-warning{{TRUE}} expected-warning{{FALSE}}
343 if (i3 != i2) {
344 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
345 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
346 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
347 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
349 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
350 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
351 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
352 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
356 void test_lower_bound2(std::vector<int> V, int n) {
357 const auto i1 = return_any_iterator(V.begin());
358 const auto i2 = return_any_iterator(V.begin());
360 const auto i3 = std::lower_bound(i1, i2, n, compare);
362 clang_analyzer_eval(i3 == i2); // expected-warning{{TRUE}} expected-warning{{FALSE}}
364 if (i3 != i2) {
365 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
366 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
367 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
368 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
370 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
371 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
372 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
373 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
377 void test_upper_bound1(std::vector<int> V, int n) {
378 const auto i1 = return_any_iterator(V.begin());
379 const auto i2 = return_any_iterator(V.begin());
381 const auto i3 = std::upper_bound(i1, i2, n);
383 clang_analyzer_eval(i3 == i2); // expected-warning{{TRUE}} expected-warning{{FALSE}}
385 if (i3 != i2) {
386 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
387 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
388 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
389 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
391 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
392 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
393 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
394 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
398 void test_upper_bound2(std::vector<int> V, int n) {
399 const auto i1 = return_any_iterator(V.begin());
400 const auto i2 = return_any_iterator(V.begin());
402 const auto i3 = std::upper_bound(i1, i2, n, compare);
404 clang_analyzer_eval(i3 == i2); // expected-warning{{TRUE}} expected-warning{{FALSE}}
406 if (i3 != i2) {
407 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
408 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
409 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
410 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
412 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
413 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
414 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
415 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
419 void test_search1(std::vector<int> V1, std::vector<int> V2) {
420 const auto i1 = return_any_iterator(V1.begin());
421 const auto i2 = return_any_iterator(V1.begin());
422 const auto i3 = return_any_iterator(V2.begin());
423 const auto i4 = return_any_iterator(V2.begin());
425 const auto i5 = std::search(i1, i2, i3, i4);
427 clang_analyzer_eval(i5 == i2); // expected-warning{{TRUE}} expected-warning{{FALSE}}
429 if (i5 != i2) {
430 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
431 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
432 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
433 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
435 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
436 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
437 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
438 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
442 void test_search2(std::vector<int> V1, std::vector<int> V2) {
443 const auto i1 = return_any_iterator(V1.begin());
444 const auto i2 = return_any_iterator(V1.begin());
445 const auto i3 = return_any_iterator(V2.begin());
446 const auto i4 = return_any_iterator(V2.begin());
448 const auto i5 = std::search(std::execution::sequenced_policy(),
449 i1, i2, i3, i4);
451 clang_analyzer_eval(i5 == i2); // expected-warning{{TRUE}} expected-warning{{FALSE}}
453 if (i5 != i2) {
454 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
455 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
456 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
457 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
459 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
460 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
461 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
462 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
466 void test_search3(std::vector<int> V1, std::vector<int> V2) {
467 const auto i1 = return_any_iterator(V1.begin());
468 const auto i2 = return_any_iterator(V1.begin());
469 const auto i3 = return_any_iterator(V2.begin());
470 const auto i4 = return_any_iterator(V2.begin());
472 const auto i5 = std::search(i1, i2, i3, i4, odd);
474 clang_analyzer_eval(i5 == i2); // expected-warning{{TRUE}} expected-warning{{FALSE}}
476 if (i5 != i2) {
477 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
478 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
479 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
480 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
482 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
483 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
484 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
485 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
489 void test_search4(std::vector<int> V1, std::vector<int> V2) {
490 const auto i1 = return_any_iterator(V1.begin());
491 const auto i2 = return_any_iterator(V1.begin());
492 const auto i3 = return_any_iterator(V2.begin());
493 const auto i4 = return_any_iterator(V2.begin());
495 const auto i5 = std::search(std::execution::sequenced_policy(),
496 i1, i2, i3, i4, odd);
498 clang_analyzer_eval(i5 == i2); // expected-warning{{TRUE}} expected-warning{{FALSE}}
500 if (i5 != i2) {
501 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
502 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
503 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
504 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
506 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
507 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
508 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
509 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
513 void test_search5(std::vector<int> V1, std::vector<int> V2) {
514 const auto i1 = return_any_iterator(V1.begin());
515 const auto i2 = return_any_iterator(V1.begin());
516 const auto i3 = return_any_iterator(V2.begin());
517 const auto i4 = return_any_iterator(V2.begin());
519 const auto i5 = std::search(i1, i2, std::default_searcher(i3, i4));
521 clang_analyzer_eval(i5 == i2); // expected-warning{{TRUE}} expected-warning{{FALSE}}
523 if (i5 != i2) {
524 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
525 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
526 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
527 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
529 clang_analyzer_eval(clang_analyzer_iterator_position(i5) <
530 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
531 clang_analyzer_eval(clang_analyzer_iterator_position(i5) >=
532 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
536 void test_search_n1(std::vector<int> V, int n) {
537 const auto i1 = return_any_iterator(V.begin());
538 const auto i2 = return_any_iterator(V.begin());
540 const auto i3 = std::search_n(i1, i2, 2, n);
542 clang_analyzer_eval(i3 == i2); // expected-warning{{TRUE}} expected-warning{{FALSE}}
544 if (i3 != i2) {
545 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
546 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
547 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
548 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
550 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
551 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
552 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
553 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
557 void test_search_n2(std::vector<int> V, int n) {
558 const auto i1 = return_any_iterator(V.begin());
559 const auto i2 = return_any_iterator(V.begin());
561 const auto i3 = std::search_n(std::execution::sequenced_policy(),
562 i1, i2, 2, n);
564 clang_analyzer_eval(i3 == i2); // expected-warning{{TRUE}} expected-warning{{FALSE}}
566 if (i3 != i2) {
567 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
568 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
569 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
570 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
572 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
573 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
574 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
575 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
579 void test_search_n3(std::vector<int> V, int n) {
580 const auto i1 = return_any_iterator(V.begin());
581 const auto i2 = return_any_iterator(V.begin());
583 const auto i3 = std::search_n(i1, i2, 2, n, compare);
585 clang_analyzer_eval(i3 == i2); // expected-warning{{TRUE}} expected-warning{{FALSE}}
587 if (i3 != i2) {
588 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
589 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
590 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
591 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
593 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
594 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
595 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
596 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}
600 void test_search_n4(std::vector<int> V, int n) {
601 const auto i1 = return_any_iterator(V.begin());
602 const auto i2 = return_any_iterator(V.begin());
604 const auto i3 = std::search_n(std::execution::sequenced_policy(),
605 i1, i2, 2, n, compare);
607 clang_analyzer_eval(i3 == i2); // expected-warning{{TRUE}} expected-warning{{FALSE}}
609 if (i3 != i2) {
610 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
611 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{TRUE}}
612 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
613 clang_analyzer_iterator_position(i1)); // expected-warning@-1{{FALSE}}
615 clang_analyzer_eval(clang_analyzer_iterator_position(i3) <
616 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{TRUE}}
617 clang_analyzer_eval(clang_analyzer_iterator_position(i3) >=
618 clang_analyzer_iterator_position(i2)); // expected-warning@-1{{FALSE}}