| 1 |
// PR ipa/69239 |
| 2 |
// { dg-do run } |
| 3 |
// { dg-options "-O2 --param=early-inlining-insns=196" } |
| 4 |
// { dg-additional-options "-fPIC" { target fpic } } |
| 5 |
|
| 6 |
struct D |
| 7 |
{ |
| 8 |
float f; |
| 9 |
D () {} |
| 10 |
virtual float bar (float z); |
| 11 |
}; |
| 12 |
|
| 13 |
struct A |
| 14 |
{ |
| 15 |
A (); |
| 16 |
virtual int foo (int i); |
| 17 |
}; |
| 18 |
|
| 19 |
struct B : public D, public A |
| 20 |
{ |
| 21 |
virtual int foo (int i); |
| 22 |
}; |
| 23 |
|
| 24 |
float |
| 25 |
D::bar (float) |
| 26 |
{ |
| 27 |
return f / 2; |
| 28 |
} |
| 29 |
|
| 30 |
int |
| 31 |
A::foo (int i) |
| 32 |
{ |
| 33 |
return i + 1; |
| 34 |
} |
| 35 |
|
| 36 |
int |
| 37 |
B::foo (int i) |
| 38 |
{ |
| 39 |
return i + 2; |
| 40 |
} |
| 41 |
|
| 42 |
int __attribute__ ((noinline,noclone)) |
| 43 |
baz () |
| 44 |
{ |
| 45 |
return 1; |
| 46 |
} |
| 47 |
|
| 48 |
static int __attribute__ ((noinline)) |
| 49 |
fn (A *obj, int i) |
| 50 |
{ |
| 51 |
return obj->foo (i); |
| 52 |
} |
| 53 |
|
| 54 |
inline __attribute__ ((always_inline)) |
| 55 |
A::A () |
| 56 |
{ |
| 57 |
if (fn (this, baz ()) != 2) |
| 58 |
__builtin_abort (); |
| 59 |
} |
| 60 |
|
| 61 |
static void |
| 62 |
bah () |
| 63 |
{ |
| 64 |
B b; |
| 65 |
} |
| 66 |
|
| 67 |
int |
| 68 |
main () |
| 69 |
{ |
| 70 |
bah (); |
| 71 |
} |