view gcc/testsuite/gcc.dg/lto/alias-access-path-2_0.c @ 158:494b0b89df80 default tip

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

/* { dg-lto-do run } */
/* { dg-lto-options { { -O3 -flto -fno-early-inlining } } } */

/* In this test the access patch orracle (aliasing_component_refs_p)
   can disambiguage array[0] from array[1] by base+offset but it needs to be
   able to find the common type and not give up by not being able to compare
   types earlier.  */

typedef int (*fnptr) ();

__attribute__ ((used))
struct a
{
  void *array[2];
} a, *aptr = &a;

__attribute__ ((used))
struct b
{
 struct a a;
} *bptr;

static void
inline_me_late (int argc)
{
  if (argc == -1)
    bptr->a.array[1] = bptr;
}

int
main (int argc)
{
  aptr->array[0] = 0;
  inline_me_late (argc);
  if (!__builtin_constant_p (aptr->array[0] == 0))
    __builtin_abort ();
  return 0;
}