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

/* A two-deep mutual recursion, with no limit, and
   failing to walk the list, thus leading to an infinite recursion.  */

struct node
{
  struct node *child;
};

void foo (struct node *f);

void bar (struct node *b)
{
  foo (b); /* { dg-warning "infinite recursion" } */
}

void foo (struct node *f)
{
  if (f->child)
    /* Bug: should have recursed to f->child, not to f.  */
    bar (f); /* { dg-warning "infinite recursion" } */
}