| 1 |
// PR debug/39086 |
| 2 |
// { dg-options "-g -O -fno-tree-sra" } |
| 3 |
|
| 4 |
struct A { int v; }; |
| 5 |
|
| 6 |
A ax; |
| 7 |
|
| 8 |
struct B |
| 9 |
{ |
| 10 |
static A f1 () { return ax; } |
| 11 |
static bool f2 (); |
| 12 |
static A f3 (); |
| 13 |
}; |
| 14 |
|
| 15 |
struct C |
| 16 |
{ |
| 17 |
A f4 () |
| 18 |
{ |
| 19 |
A x; |
| 20 |
if (__builtin_expect (this->f6 () < this->f12 (), true)) |
| 21 |
x = B::f1 (); |
| 22 |
else |
| 23 |
x = this->f7 (); |
| 24 |
return x; |
| 25 |
} |
| 26 |
A f5 () |
| 27 |
{ |
| 28 |
A y; |
| 29 |
if (this->f6 () < this->f12 ()) |
| 30 |
y = B::f1 (); |
| 31 |
else |
| 32 |
y = this->f7 (); |
| 33 |
return y; |
| 34 |
} |
| 35 |
void *f6 () const; |
| 36 |
void *f12 () const; |
| 37 |
virtual A f7 (); |
| 38 |
}; |
| 39 |
|
| 40 |
C *dx; |
| 41 |
|
| 42 |
struct D |
| 43 |
{ |
| 44 |
C *f8 () const; |
| 45 |
}; |
| 46 |
|
| 47 |
class E : virtual public D |
| 48 |
{ |
| 49 |
void f11 (); |
| 50 |
void f9 (); |
| 51 |
void f10 (); |
| 52 |
}; |
| 53 |
|
| 54 |
struct G |
| 55 |
{ |
| 56 |
explicit G (); |
| 57 |
operator bool () const; |
| 58 |
}; |
| 59 |
|
| 60 |
void |
| 61 |
E::f11 (void) |
| 62 |
{ |
| 63 |
A d = B::f3 (); |
| 64 |
d = this->f8 ()->f4 (); |
| 65 |
} |
| 66 |
|
| 67 |
void |
| 68 |
E::f9 () |
| 69 |
{ |
| 70 |
G c; |
| 71 |
if (c) |
| 72 |
{ |
| 73 |
const A e = B::f3 (); |
| 74 |
C * f = this->f8 (); |
| 75 |
A d = f->f5 (); |
| 76 |
if (B::f2 ()) |
| 77 |
; |
| 78 |
else if (B::f2 ()) |
| 79 |
f->f4 (); |
| 80 |
} |
| 81 |
} |
| 82 |
|
| 83 |
void |
| 84 |
E::f10 () |
| 85 |
{ |
| 86 |
G c; |
| 87 |
if (c) |
| 88 |
{ |
| 89 |
const A e = B::f3 (); |
| 90 |
C * f = this->f8 (); |
| 91 |
A d = f->f5 (); |
| 92 |
if (B::f2 ()) |
| 93 |
; |
| 94 |
else if (B::f2 ()) |
| 95 |
f->f4 (); |
| 96 |
} |
| 97 |
} |