Hi,
here is testcase for that.

I think we need to get rid of most -1 return values to make access path
matching work.  Here we work out that stroing to *bptr
is not going to affect a since *bptr is a struct, but alias set
conflicts does not help.

This fails w/o patch sine struct b and int * compares as -1.

/* { dg-lto-do run } */
/* { dg-lto-options { { -O3 -flto -fno-early-inlining } } } */
#include <stdlib.h>

/* We should disambiguate
     int *
   and
     struct a *
   despite the fact they get same alias set because struct a is incomplete.  */

typedef int (*fnptr) ();

__attribute__ ((used))
int *a,**aptr=&a;

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

static void
inline_me_late (int argc)
{
  if (argc == -1)
    *bptr = b;
}

int
main (int argc)
{
  a = 0;
  inline_me_late (argc);
  if (!__builtin_constant_p (a == 0))
    __builtin_abort ();
  return 0;
}

Reply via email to