aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/analyzer/params.c
blob: 12bba70d6e4d21b4e1be9d8e059993b2736e5bc4 (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
#include "analyzer-decls.h"

static int __analyzer_called_function(int j)
{
  int k;

  __analyzer_eval (j > 4); /* { dg-warning "TRUE" } */

  k = j - 1;

  __analyzer_eval (k > 3); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
  /* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
  /* TODO(xfail): we're not then updating based on the assignment.  */

  return k;
}

void test(int i)
{
  __analyzer_eval (i > 4); /* { dg-warning "UNKNOWN" } */

  if (i > 4) {

    __analyzer_eval (i > 4); /* { dg-warning "TRUE" } */

    i = __analyzer_called_function(i);

    __analyzer_eval (i > 3); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
    /* { dg-warning "UNKNOWN" "status quo" { target *-*-* } .-1 } */
    /* TODO(xfail): we're not updating from the returned value.  */
  }

  __analyzer_eval (i > 3); /* { dg-warning "UNKNOWN" } */
}