https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87843

--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
I can only see that v->locs might be affected by fld because the type of the
FIELD_DECL changes but the (alias) type of *p_11 remains the same.  Thus
we have get_alias_set (ptr-to-incomplete) and get_alias_set (ptr-to-complete)
not agreeing.  But of course they have to.

I guess we can make a two-unit LTO testcase like the following - but it
doesn't miscompile since we end up substituting the MEM_REF base type
for the store in foo() somehow so even with more fiddling I always get

  *p_5 = &a;
  py ={v} &y;
  _1 ={v} py;
  MEM[(struct Y *)_1].p = &b;
^^^ will not use the alias set of .p

  _2 = *p_5;




struct X;
struct Y { struct X *p; };

void foo (struct Y *p, struct X *v)
{
  p->p = v;
}

---

struct X { int i; };
struct Y { struct X *p; };

void foo (struct Y *, struct X *);
struct X ** volatile px;
struct X a, b;
int main()
{
  struct Y y;
  px = &y.p;
  struct X **p = px; 
  *p = &a;
  foo (&y, &b);
  if (*p != &b)
    __builtin_abort ();
  return 0;
}

Reply via email to