1 // { dg-do run } 2 // { dg-options "-O2" } 3 // Test for bad loop optimization of goto fixups. 4 5 typedef bool (*ftype) (); 6 7 int c, d; 8 struct A { AA9 A() { ++c; } AA10 A(const A&) { ++c; } ~AA11 ~A() { ++d; } 12 }; 13 f(ftype func)14void f (ftype func) 15 { 16 A a; 17 do { 18 if ((*func)()) return; 19 } while (true); 20 } 21 test()22bool test () 23 { 24 return true; 25 } 26 main()27main () 28 { 29 f (test); 30 return (c != d); 31 } 32