OSDN Git Service

PR testsuite/20772
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / opt / reg-stack2.C
1 // PR target/9786
2 // Origin: <nick@ilm.com>
3
4 // This used to fail on x86 because the reg-stack pass deleted
5 // an insn that could seemingly trap (but actually doesn't)
6 // without updating the CFG.
7
8 // { dg-do compile }
9 // { dg-options "-O2 -fnon-call-exceptions" }
10
11 struct D1 {
12     float l;
13     D1 GS() const {D1 d;float f=.299*l;d.l=f;return d;}
14     static D1 G() {return D1();}
15 };
16
17 struct D2 {
18     D1 g;
19     D2(const D1& gi) : g(gi) {}
20     D2 GS() const {return D2(g.GS());}
21 };
22
23 class A {
24   public:
25     virtual ~A() {}
26 };
27
28 class B : public A {
29   public:
30     B(const D2& mi);
31     D2 fm;
32 };
33
34 B::B(const D2 &mi) : fm(mi.GS()) {}