Debian Codegraph @

gcc/testsuite/c-c++-common/analyzer/loop-2a.c

raw
1 /* { dg-additional-options "-fno-analyzer-state-purge" } */
2 #include "../../gcc.dg/analyzer/analyzer-decls.h"
3
4 union u
5 {
6 int i;
7 };
8
9 void test(void)
10 {
11 union u u;
12
13 __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */
14
15
16 for (u.i=0; u.i<256; u.i++) {
17 __analyzer_eval (u.i < 256); /* { dg-warning "TRUE" } */
18
19 __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */
20
21 //__analyzer_eval (u.i == 0); /* { d-todo-g-warning "UNKNOWN" "" { xfail *-*-* } } */
22 /* { d-todo-g-warning "TRUE" "" { target *-*-* } .-1 } */
23 /* TODO(xfail^^^): we're only capturing the first iteration, so
24 we erroneously get i == 0. */
25
26 __analyzer_eval (u.i >= 0); /* { dg-warning "TRUE" } */
27 }
28
29 __analyzer_eval (u.i >= 256); /* { dg-warning "TRUE" } */
30
31 __analyzer_eval (u.i == 256); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
32 /* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
33 /* TODO(xfail^^^): ideally it should figure out i == 256 at exit. */
34
35 __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */
36 }