gcc/testsuite/g++.dg/pr64191.C
raw| 1 | // { dg-do compile } |
| 2 | // { dg-options "-O2 -fdump-tree-cddce1" } |
| 3 | |
| 4 | struct Bar |
| 5 | { |
| 6 | int i; |
| 7 | ~Bar() { } |
| 8 | }; |
| 9 | void bar_dtor_loop(Bar* p, unsigned int n) |
| 10 | { |
| 11 | if (p) { |
| 12 | Bar* e = p + n; |
| 13 | while (e > p) { |
| 14 | --e; |
| 15 | e->~Bar(); |
| 16 | } |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | // The clobber in ~Bar should persist but those inlined into |
| 21 | // bar_dtor_loop not, nor should the loop therein |
| 22 | |
| 23 | // { dg-final { scan-tree-dump-times "CLOBBER" 1 "cddce1" } } |
| 24 | // { dg-final { scan-tree-dump-times "if" 0 "cddce1" } } |