view gcc/testsuite/g++.dg/ipa/remref-2.C @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 84e7813d76e9
children
line wrap: on
line source

/* Verify that we survive creation and deletion of references to facilitate
   reference removal while also doing (unsuccessful) speculative
   devirtualization.  */
/* { dg-do link } */
/* { dg-options "-O3 -fno-early-inlining"  } */

class A
{
  public:
  virtual void __attribute__ ((noinline)) foo(void (*)(void));
};

static
void b(void)
{
}

void  __attribute__ ((noinline))
A::foo(void (*back)(void))
{
  back();
}

class A *a;

void __attribute__ ((noinline, noclone))
allocate_a ()
{
  a = new A();
}

int main()
{
  allocate_a();
  for (int i=0; i<10000;i++)
    a->foo(b);
}