1 #include "analyzer-decls.h"
2
test(int start,int end,int step)3 void test(int start, int end, int step)
4 {
5 int i;
6
7 __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */
8
9 for (i = start; i < end; i += step) {
10 __analyzer_eval (i < end); /* { dg-warning "TRUE" "true" } */
11 /* { dg-bogus "UNKNOWN" "unknown" { xfail *-*-* } .-1 } */
12 /* TODO(xfail^^^): should report TRUE twice. */
13
14 __analyzer_eval (i == start); /* { dg-warning "TRUE" "1st" } */
15 /* { dg-warning "FALSE" "2nd" { xfail *-*-* } .-1 } */
16 /* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-2 } */
17 /* TODO(xfail^^^): ideally we ought to figure out i > 0 after 1st iteration. */
18
19 /* We don't know the direction of step. */
20 __analyzer_eval (i >= start); /* { dg-warning "TRUE" "true" } */
21 /* { dg-warning "UNKNOWN" "unknown" { target *-*-* } .-1 } */
22
23 __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */
24 }
25
26 // FIXME: do we know this? What about direction of step?
27 __analyzer_eval (i >= end); /* { dg-warning "TRUE" "true" { xfail *-*-* } } */
28 /* { dg-bogus "UNKNOWN" "unknown" { xfail *-*-* } .-1 } */
29
30 // FIXME: do we know this? What if we overshoot?
31 __analyzer_eval (i == end); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
32 /* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
33 /* TODO(xfail^^^): it only figures out i >= 256, rather than i == 256. */
34
35 __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */
36 }
37