aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/analyzer/infinite-recursion-3.c
blob: 2ae20a1108a7d21522f35d23be4ab40da5d6b33e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/* { dg-additional-options "-fno-analyzer-call-summaries -Wno-analyzer-too-complex -Wno-analyzer-symbol-too-complex" } */

struct node
{
  struct node *left;
  struct node *right;
  int val;
};

int sum (struct node *n)
{
  int result = 0;
  if (n->left)
    result += sum (n->left); /* { dg-bogus "infinite recursion" } */
  if (n->right)
    result += sum (n->right); /* { dg-bogus "infinite recursion" } */
  return result;
}