gcc/testsuite/g++.dg/asan/pr95025.C
raw| 1 | // { dg-do compile } |
| 2 | // { dg-options "-O2 -fsanitize=address" } |
| 3 | |
| 4 | struct a { |
| 5 | int b; |
| 6 | } * c; |
| 7 | struct d { |
| 8 | d *e; |
| 9 | }; |
| 10 | struct f { |
| 11 | bool done; |
| 12 | d *g; |
| 13 | }; |
| 14 | int h; |
| 15 | int i(f *j) { |
| 16 | if (j->g) { |
| 17 | j->g = j->g->e; |
| 18 | return h; |
| 19 | } |
| 20 | j->done = true; |
| 21 | return 0; |
| 22 | } |
| 23 | void k(bool j) { c->b = j; } |
| 24 | void l() { |
| 25 | f a; |
| 26 | for (; !(&a)->done; i(&a)) |
| 27 | k(true); |
| 28 | } |