1// PR optimization/11646 2// Origin: <nick@ilm.com> 3 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. 7 8// { dg-do compile } 9// { dg-options "-O -fgcse -fnon-call-exceptions" } 10 11struct C 12{ 13 int i; 14}; 15 16struct allocator 17{ 18 ~allocator() throw() {} 19}; 20 21struct _Vector_alloc_base 22{ 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) {} 27}; 28 29struct _Vector_base : _Vector_alloc_base 30{ 31 _Vector_base(const allocator& __a) : _Vector_alloc_base(__a) { } 32 ~_Vector_base() { _M_deallocate(0, _M_end_of_storage - _M_start); } 33}; 34 35struct vector : _Vector_base 36{ 37 vector(const allocator& __a = allocator()) : _Vector_base(__a) {} 38 struct C& operator[](unsigned int __n) { return *_M_start; } 39}; 40 41struct A 42{ 43 float l() const; 44 A operator-(const A &) const; 45 const A& operator=(float) const; 46}; 47 48struct B 49{ 50 float d(); 51}; 52 53float f(const A& a, B& b) 54{ 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(); 61} 62