view gcc/testsuite/gcc.dg/lto/alias-access-path-2_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 -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;
}