blob: a71b9029af97b77fd70864d094f0af2a91da2a59 (
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
|
/* { dg-additional-options "-fno-analyzer-call-summaries -Wno-analyzer-too-complex" } */
/* A two-deep mutual recursion, and failing to walk a list,
but with a depth limit, thus not an infinite recursion (assuming a
suitable 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)
/* Bug: should have recursed to f->child, not to f,
but we assume that the depth limit should save us. */
bar (f, depth - 1); /* { dg-bogus "infinite recursion" } */
}
|