aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/analyzer/loop-2a.c
blob: 16b64497cb7d33657beaeca8b027b3e420416897 (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
/* { dg-additional-options "-fno-analyzer-state-purge" } */
#include "analyzer-decls.h"

union u
{
  int i;
};

void test(void)
{
  union u u;

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


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

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

    //__analyzer_eval (u.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 (u.i >= 0); /* { dg-warning "TRUE" } */
  }

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

  __analyzer_eval (u.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" } */
}