1// PR optimization/11083 2// Origin: <nick@ilm.com> 3// Reduced testcase by Wolfgang Bangerth <bangerth@ticam.utexas.edu> 4 5// The compiler used to keep unreachable basic blocks after dead edges 6// had been purged, which fooled the LCM code of the GCSE pass. 7 8// { dg-do compile } 9// { dg-options "-O2 -fnon-call-exceptions" } 10 11extern void *memmove (void *, const void *, unsigned int) throw (); 12 13struct S { 14 int *q; 15 16 S(int *i) : q(i) {} 17}; 18 19struct X { 20 int *p; 21 22 void foo(S first, S last) { 23 try { memmove(0, 0, last.q - first.q); } 24 catch(...) { throw; } 25 } 26 27 void bar (const X& x); 28}; 29 30void X::bar (const X& x) 31{ 32 const unsigned int xlen = S(x.p).q - S(x.p).q; 33 34 if (xlen > 0) 35 foo(S(x.p), S(x.p)); 36} 37