| 1 |
// PR optimization/11083 |
| 2 |
// Origin: <[email protected]> |
| 3 |
// Reduced testcase by Wolfgang Bangerth <[email protected]> |
| 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 |
|
| 11 |
extern void *memmove (void *, const void *, unsigned int) throw (); |
| 12 |
|
| 13 |
struct S { |
| 14 |
int *q; |
| 15 |
|
| 16 |
S(int *i) : q(i) {} |
| 17 |
}; |
| 18 |
|
| 19 |
struct 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 |
|
| 30 |
void 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 |
} |