gcc/testsuite/c-c++-common/analyzer/infinite-recursion-pr108935-1.c
raw| 1 | typedef struct { |
| 2 | unsigned idx; |
| 3 | int vals[512]; |
| 4 | } foo_t; |
| 5 | |
| 6 | int ended(foo_t* f) { |
| 7 | return f->idx >= 512; |
| 8 | } |
| 9 | unsigned foo(foo_t* f) { |
| 10 | if (ended(f)) { |
| 11 | return f->idx; |
| 12 | } |
| 13 | do { |
| 14 | f->idx++; |
| 15 | } while(!ended(f) && !f->vals[f->idx]); |
| 16 | return foo(f); /* { dg-bogus "infinite recursion" } */ |
| 17 | } |