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