aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/asan/pr95025.C
blob: dabb7e92f82443040168d0ead8f06332df900931 (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
26
27
28
// { dg-do compile }
// { dg-options "-O2 -fsanitize=address" }

struct a {
    int b;
} * c;
struct d {
    d *e;
};
struct f {
    bool done;
    d *g;
};
int h;
int i(f *j) {
    if (j->g) {
	j->g = j->g->e;
	return h;
    }
    j->done = true;
    return 0;
}
void k(bool j) { c->b = j; }
void l() {
    f a;
    for (; !(&a)->done; i(&a))
      k(true);
}