2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.dg / opt / cfg3.C
blob123c2f5157ba77ba453658ea0db60a7060ea322b
1 // PR optimization/11646
2 // Origin: <nick@ilm.com>
4 // This used to fail because the compiler inadvertently cleared
5 // the EDGE_ABNORMAL flag on a EDGE_EH edge and didn't delete
6 // unreachable blocks after CSE.
8 // { dg-do compile }
9 // { dg-options "-O -fgcse -fnon-call-exceptions" }
11 struct C
13   int i;
16 struct allocator
18   ~allocator() throw() {}
21 struct _Vector_alloc_base
23   _Vector_alloc_base(const allocator& __a) {}
24   allocator _M_data_allocator;
25   struct C *_M_start, *_M_end_of_storage;
26   void _M_deallocate(struct C* __p, unsigned int __n) {}
29 struct _Vector_base : _Vector_alloc_base
31   _Vector_base(const allocator& __a) : _Vector_alloc_base(__a) { }
32   ~_Vector_base() { _M_deallocate(0, _M_end_of_storage - _M_start); }
35 struct vector : _Vector_base
37   vector(const allocator& __a = allocator()) : _Vector_base(__a) {}
38   struct C& operator[](unsigned int __n) { return *_M_start; }
41 struct A
43   float l() const;
44   A operator-(const A &) const;
45   const A& operator=(float) const;
48 struct B
50   float d();
53 float f(const A& a, B& b)
55   vector vc;
56   int index = vc[0].i;
57   A aa;
58   float d = (aa - a).l();
59   if (d > b.d()) aa = 0;
60     return b.d();