aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/analyzer/infinite-recursion-pr108935-1a.c
blob: b3c4920b10d2b7c28207c64a9d2452741d44a7d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
typedef struct {
    unsigned idx;
    int vals[512];
} foo_t;

int ended(foo_t* f) {
    return f->idx >= 512;
}
unsigned foo(foo_t* f) {
    if (ended(f)) {
        return f->idx;
    }
    do {
        f->idx += 1000;
    } while(!ended(f) && !f->vals[f->idx]);
    return foo(f); /* { dg-bogus "infinite recursion" } */
}