1 // PR target/18841 2 // { dg-do run } 3 // { dg-options "-O2" } 4 5 extern "C" void abort (); 6 7 int r, i1 = 1, i2 = 2, i3 = 3, i4 = 4, i5 = 5; 8 9 struct S 10 { ~SS11 ~S() { r = i1 + i2 + i3 + i4 + i5; } 12 }; 13 foo()14void foo() 15 { 16 S s; 17 throw 1; 18 } 19 bar()20void bar() 21 { 22 try { 23 foo(); 24 } catch (...) { 25 } 26 } 27 main()28int main() 29 { 30 bar(); 31 if (r != 1 + 2 + 3 + 4 + 5) 32 abort (); 33 } 34