| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-require-effective-target fpic } */ |
| 3 |
/* { dg-options "-O2 -fdump-tree-cddce1-details -fdump-tree-optimized -fPIC" } */ |
| 4 |
// { dg-require-effective-target cxa_atexit } |
| 5 |
/* This test is not appropriate for targets where non-weak functions defined |
| 6 |
in the TU always bind locally; see PR114982. */ |
| 7 |
/* { dg-skip-if "PR114982" { *-*-darwin* } } */ |
| 8 |
/* PR tree-optimization/19661 */ |
| 9 |
|
| 10 |
/* The call to axexit should not be removed as A::~A() cannot be figured if it |
| 11 |
is a pure/const function call for platforms where the function call g does |
| 12 |
not bind locally. */ |
| 13 |
|
| 14 |
__attribute__((noinline)) |
| 15 |
void g() {} |
| 16 |
|
| 17 |
struct A { |
| 18 |
A(); |
| 19 |
~A() { g(); } |
| 20 |
}; |
| 21 |
|
| 22 |
void foo () { |
| 23 |
static A a; |
| 24 |
} |
| 25 |
|
| 26 |
/* { dg-final { scan-tree-dump-not "Deleting : (?:__cxxabiv1::__cxa_atexit|__aeabiv1::__aeabi_atexit)" "cddce1" } } */ |
| 27 |
/* { dg-final { scan-tree-dump-times "(?:__cxa_atexit|__aeabi_atexit)" 1 "optimized" } } */ |
| 28 |
|