view gcc/testsuite/g++.dg/lto/alias-5_0.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
line wrap: on
line source

/* { dg-lto-do run } */
/* { dg-lto-options { { -O3 -flto } } } */
/* This testcase tests that anonymous namespaces in different TUs are treated
   as different types by LTO TBAA and that they never alias with structurally
   same C types.  */
namespace {
  __attribute__((used))
  struct a {int a;} *p,**ptr=&p;
};
void
set1()
{
  *ptr=0;
}
void
get1()
{
  if (!__builtin_constant_p (*ptr==0))
    __builtin_abort ();
}
extern void set2();
extern "C" void set3();
int n = 1;
int
main()
{
  for (int i = 0; i < n; i++)
    {
      set1();
      set2();
      set3();
      get1();
    }
  return 0;
}