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

/* A two-deep mutual recursion, walking a singly-linked list,
   with a depth limit.  */

struct node
{
  struct node *child;
};

void foo (struct node *f, int depth);

void bar (struct node *b, int depth)
{
  foo (b, depth); /* { dg-bogus "infinite recursion" } */
}

void foo (struct node *f, int depth)
{
  if (f->child && depth > 0)
    bar (f->child, depth - 1); /* { dg-bogus "infinite recursion" } */
}