gcc/testsuite/g++.dg/opt/pr51596.C
raw| 1 | // PR tree-optimization/51596 |
| 2 | // { dg-do compile } |
| 3 | // { dg-options "-O -fnon-call-exceptions" } |
| 4 | |
| 5 | struct A { float v[2]; }; |
| 6 | struct B { int v[2]; }; |
| 7 | |
| 8 | struct C |
| 9 | { |
| 10 | B c; |
| 11 | C f () |
| 12 | { |
| 13 | B b; |
| 14 | for (int i = 0; i < 2; i++) |
| 15 | b.v[i] = c.v[i]; |
| 16 | return *this; |
| 17 | } |
| 18 | }; |
| 19 | |
| 20 | struct D |
| 21 | { |
| 22 | A d; |
| 23 | D (B x) |
| 24 | { |
| 25 | for (int i = 0; i < 2; i++) |
| 26 | d.v[i] = x.v[i]; |
| 27 | } |
| 28 | }; |
| 29 | |
| 30 | int bar (); |
| 31 | |
| 32 | C i; |
| 33 | |
| 34 | void |
| 35 | foo () |
| 36 | { |
| 37 | while (bar ()) |
| 38 | D (i.f ().c); |
| 39 | } |