| 1 |
/* { dg-options "-mthumb" { target arm*-*-* } } */ |
| 2 |
/* { dg-do run } */ |
| 3 |
/* { dg-timeout 100 } */ |
| 4 |
|
| 5 |
/* PR middle-end/39378 */ |
| 6 |
/* Check if the thunk target function is emitted correctly. */ |
| 7 |
class B1 |
| 8 |
{ |
| 9 |
public: |
| 10 |
virtual int foo1(void); |
| 11 |
int b1; |
| 12 |
}; |
| 13 |
|
| 14 |
class B2 |
| 15 |
{ |
| 16 |
public: |
| 17 |
virtual int foo2 (void); |
| 18 |
int b2; |
| 19 |
}; |
| 20 |
|
| 21 |
class D : public B1, public B2 |
| 22 |
{ |
| 23 |
int foo1(void); |
| 24 |
int foo2(void); |
| 25 |
int d; |
| 26 |
}; |
| 27 |
|
| 28 |
int B1::foo1(void) |
| 29 |
{ |
| 30 |
return 3; |
| 31 |
} |
| 32 |
|
| 33 |
int B2::foo2(void) |
| 34 |
{ |
| 35 |
return 4; |
| 36 |
} |
| 37 |
|
| 38 |
int D::foo1(void) |
| 39 |
{ |
| 40 |
return 1; |
| 41 |
} |
| 42 |
|
| 43 |
int D::foo2(void) |
| 44 |
{ |
| 45 |
return 2; |
| 46 |
} |
| 47 |
|
| 48 |
__attribute__((noinline)) int test(B2* bp) |
| 49 |
{ |
| 50 |
return bp->foo2(); |
| 51 |
} |
| 52 |
|
| 53 |
int main() |
| 54 |
{ |
| 55 |
B2 *bp = new D(); |
| 56 |
if (test(bp) == 2) |
| 57 |
return 0; |
| 58 |
else |
| 59 |
return 1; |
| 60 |
} |