| 1 |
/* { dg-additional-options "-fno-analyzer-call-summaries -Wno-analyzer-too-complex" } */ |
| 2 |
|
| 3 |
/* A two-deep mutual recursion, with no limit, and |
| 4 |
failing to walk the list, thus leading to an infinite recursion. */ |
| 5 |
|
| 6 |
struct node |
| 7 |
{ |
| 8 |
struct node *child; |
| 9 |
}; |
| 10 |
|
| 11 |
void foo (struct node *f); |
| 12 |
|
| 13 |
void bar (struct node *b) |
| 14 |
{ |
| 15 |
foo (b); /* { dg-warning "infinite recursion" } */ |
| 16 |
} |
| 17 |
|
| 18 |
void foo (struct node *f) |
| 19 |
{ |
| 20 |
if (f->child) |
| 21 |
/* Bug: should have recursed to f->child, not to f. */ |
| 22 |
bar (f); /* { dg-warning "infinite recursion" } */ |
| 23 |
} |