2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.dg / opt / reg-stack.C
blob76d3cee1b016fd2fbd43c9bd6d92000eba3e35ce
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.
6 // { dg-do run }
7 // { dg-options "-O" }
9 extern "C" void abort ();
11 struct Base
13   virtual ~Base() {}
16 struct Foo : public Base
18   Foo ();
21 double x = 3;
22 double y = 4;
24 double bar ()
26   double z = x*x+y*y;
27   if (z != 25.0)
28     throw 1;
29   return z;
32 Foo::Foo ()
34   bar ();
37 int main ()
39   try {
40     int i;
41     for (i = 0; i < 10; ++i)
42       new Foo;
43   } catch (...) {
44     abort ();
45   }
46   return 0;