gcc/testsuite/c-c++-common/analyzer/infinite-recursion-3.c
raw| 1 | /* { dg-additional-options "-fno-analyzer-call-summaries -Wno-analyzer-too-complex -Wno-analyzer-symbol-too-complex" } */ |
| 2 | |
| 3 | struct node |
| 4 | { |
| 5 | struct node *left; |
| 6 | struct node *right; |
| 7 | int val; |
| 8 | }; |
| 9 | |
| 10 | int sum (struct node *n) |
| 11 | { |
| 12 | int result = 0; |
| 13 | if (n->left) |
| 14 | result += sum (n->left); /* { dg-bogus "infinite recursion" } */ |
| 15 | if (n->right) |
| 16 | result += sum (n->right); /* { dg-bogus "infinite recursion" } */ |
| 17 | return result; |
| 18 | } |