1 // PR target/6087 2 // The code that moves around insns emitted by reg-stack to cope with 3 // exception edges lost the REG_DEAD note indicating a pop. Which 4 // eventually fills up the register stack resulting in Z == NaN. 5 6 // { dg-do run } 7 // { dg-options "-O" } 8 9 extern "C" void abort (); 10 11 struct Base 12 { 13 virtual ~Base() {} 14 }; 15 16 struct Foo : public Base 17 { 18 Foo (); 19 }; 20 21 double x = 3; 22 double y = 4; 23 24 double bar () 25 { 26 double z = x*x+y*y; 27 if (z != 25.0) 28 throw 1; 29 return z; 30 } 31 32 Foo::Foo () 33 { 34 bar (); 35 } 36 37 int main () 38 { 39 try { 40 int i; 41 for (i = 0; i < 10; ++i) 42 new Foo; 43 } catch (...) { 44 abort (); 45 } 46 return 0; 47 } 48