gcc/testsuite/g++.dg/torture/predcom-1.C
raw| 1 | /* Test for ICE in predictive commoning with empty loop header block |
| 2 | on arm-none-linux-*. */ |
| 3 | |
| 4 | #pragma GCC diagnostic ignored "-Wreturn-type" |
| 5 | |
| 6 | struct Foo |
| 7 | { |
| 8 | double *ptr; |
| 9 | |
| 10 | Foo (double *ptr_) |
| 11 | : ptr (ptr_) |
| 12 | { |
| 13 | } |
| 14 | |
| 15 | Foo PostInc () |
| 16 | { |
| 17 | return Foo (ptr++); |
| 18 | } |
| 19 | }; |
| 20 | |
| 21 | bool Baz (Foo first, double *last) |
| 22 | { |
| 23 | Foo prev (first.ptr); |
| 24 | |
| 25 | first.ptr++; |
| 26 | |
| 27 | while (first.ptr != last) |
| 28 | if (*first.PostInc ().ptr < *prev.PostInc ().ptr) |
| 29 | return false; |
| 30 | } |
| 31 |