| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-require-alias "" } */ |
| 3 |
/* { dg-require-weak "" } */ |
| 4 |
/* { dg-options "-O2 -fdump-tree-optimized -std=gnu89" } */ |
| 5 |
void abort (void); |
| 6 |
__attribute__ ((weak)) |
| 7 |
int test() |
| 8 |
{ |
| 9 |
return 0; |
| 10 |
} |
| 11 |
static int test2() __attribute__ ((alias("test"))); |
| 12 |
static int test1() __attribute__ ((weakref)) __attribute__ ((alias("test2"))); |
| 13 |
static int test4() __attribute__ ((weakref)) __attribute__ ((alias("test"))); |
| 14 |
main() |
| 15 |
{ |
| 16 |
test(); |
| 17 |
test2(); |
| 18 |
test3(); |
| 19 |
test4(); |
| 20 |
} |
| 21 |
|
| 22 |
/* calls to test1 and test2 can be inlined and optmized away. Calls |
| 23 |
to test and test4 are overwritable. */ |
| 24 |
|
| 25 |
/* { dg-final { scan-tree-dump-times " test " 1 "optimized" } } */ |
| 26 |
/* { dg-final { scan-tree-dump-times " test4 " 1 "optimized" } } */ |
| 27 |
/* { dg-final { scan-tree-dump-not " test1 " "optimized" } } */ |
| 28 |
/* { dg-final { scan-tree-dump-not " test2 " "optimized" } } */ |