view gcc/testsuite/g++.dg/lto/alias-1_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 } } } */

/* With LTO we consider all pointers to incomplete types to be possibly
   aliasing.  This makes *bptr to alias with aptr.
   However with C++ ODR rule we can turn incomplete pointers to complete
   dragging in info from alias-1_1.C.  */

#include <string.h>

typedef int (*fnptr) ();

__attribute__ ((used))
struct a *aptr;

__attribute__ ((used))
struct b **bptr = (struct b**)&aptr;
extern void init ();
extern void inline_me_late (int);
int n=1;


int
main (int argc, char **argv)
{
  init ();
  aptr = 0;
  for (int i=0; i<n; i++)
    inline_me_late (argc);
  if (!__builtin_constant_p (aptr == 0))
    __builtin_abort ();
  return (size_t)aptr;
}