Debian Codegraph @

gcc/testsuite/g++.dg/ipa/remref-2.C

raw
1 /* Verify that we survive creation and deletion of references to facilitate
2 reference removal while also doing (unsuccessful) speculative
3 devirtualization. */
4 /* { dg-do link } */
5 /* { dg-options "-O3 -fno-early-inlining" } */
6
7 class A
8 {
9 public:
10 virtual void __attribute__ ((noinline)) foo(void (*)(void));
11 };
12
13 static
14 void b(void)
15 {
16 }
17
18 void __attribute__ ((noinline))
19 A::foo(void (*back)(void))
20 {
21 back();
22 }
23
24 class A *a;
25
26 void __attribute__ ((noinline, noclone))
27 allocate_a ()
28 {
29 a = new A();
30 }
31
32 int main()
33 {
34 allocate_a();
35 for (int i=0; i<10000;i++)
36 a->foo(b);
37 }