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
9extern "C" void abort ();
10
11struct Base
12{
13  virtual ~Base() {}
14};
15
16struct Foo : public Base
17{
18  Foo ();
19};
20
21double x = 3;
22double y = 4;
23
24double bar ()
25{
26  double z = x*x+y*y;
27  if (z != 25.0)
28    throw 1;
29  return z;
30}
31
32Foo::Foo ()
33{
34  bar ();
35}
36
37int 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