| 1 |
/* { dg-options "-fpermissive -O2 -fno-indirect-inlining -fno-devirtualize-speculatively -fdump-tree-fre3-details -fno-early-inlining" } */ |
| 2 |
#include <stdlib.h> |
| 3 |
struct A {virtual void test() {abort ();}}; |
| 4 |
struct B:A |
| 5 |
{virtual void test() {} |
| 6 |
B(); |
| 7 |
B(void (*test)(struct A *));}; |
| 8 |
|
| 9 |
void extcall(void); |
| 10 |
|
| 11 |
inline void tt(struct A *a) |
| 12 |
{ |
| 13 |
a->test(); |
| 14 |
} |
| 15 |
|
| 16 |
__attribute__ ((always_inline)) |
| 17 |
inline |
| 18 |
B::B (void (*test)(struct A *)) |
| 19 |
{ |
| 20 |
struct B c; |
| 21 |
struct A *a=this; |
| 22 |
extcall(); |
| 23 |
test(a); |
| 24 |
} |
| 25 |
void |
| 26 |
t() |
| 27 |
{ |
| 28 |
struct B b(tt); |
| 29 |
} |
| 30 |
/* After inlining the call within constructor needs to be checked to not go into a basetype. |
| 31 |
We should see the vtbl store and we should notice extcall as possibly clobbering the |
| 32 |
type but ignore it because b is in static storage. */ |
| 33 |
/* { dg-final { scan-tree-dump "No dynamic type change found." "fre3" } } */ |
| 34 |
/* { dg-final { scan-tree-dump "Checking vtbl store:" "fre3" } } */ |
| 35 |
/* { dg-final { scan-tree-dump "Function call may change dynamic type:extcall" "fre3" } } */ |
| 36 |
/* { dg-final { scan-tree-dump "converting indirect call to function virtual void" "fre3" { target { ! implicit_constexpr } } } } */ |