aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/analyzer/loop-2.c
blob: f106722c247417ff03bac6c4ade5c2e9e6c9d572 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* { dg-additional-options "-fno-analyzer-state-purge" } */
#include "analyzer-decls.h"

struct s
{
  int i;
};

void test(void)
{
  struct s s;

  __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */


  for (s.i=0; s.i<256; s.i++) {
    __analyzer_eval (s.i < 256); /* { dg-warning "TRUE" } */
      /* (should report TRUE twice). */

    __analyzer_dump_exploded_nodes (0); /* { dg-warning "2 processed enodes" } */

    //__analyzer_eval (s.i == 0); /* { d-todo-g-warning "UNKNOWN" "" { xfail *-*-* } } */
      /* { d-todo-g-warning "TRUE" "" { target *-*-* } .-1 } */
      /* TODO(xfail^^^): we're only capturing the first iteration, so
	 we erroneously get i == 0.  */

      //__analyzer_eval (s.i >= 0); /* { d-todo-g-warning "TRUE" } */
  }

  __analyzer_eval (s.i >= 256); /* { dg-warning "TRUE" } */

  __analyzer_eval (s.i == 256); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
  /* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
  /* TODO(xfail^^^): ideally it should figure out i == 256 at exit.  */

  __analyzer_dump_exploded_nodes (0); /* { dg-warning "1 processed enode" } */
}