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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Reduced testcase:

struct B {
   struct { int len; } l;
   long n;
};
struct A {
   struct B elts[8];
};

static void
set_len (struct B *b, int len)
{
  b->l.len = len;
}

static int
get_len (struct B *b)
{
  return b->l.len;
}

int foo (struct A *a, int i, long *q)
{
  set_len (&a->elts[i], 1);
  *q = 2;
  return get_len (&a->elts[i]);
}

with the patch we end up doing the following in FRE1.  I think the path
based disambiguation is unaffected by assigning a different alias set.

 int foo (struct A * a, int i, long int * q)
 {
   int D.2787;
-  int _9;

   <bb 2> :
   MEM <struct A> [(struct B *)a_3(D)].elts[i_4(D)].l.len = 1;
   *q_7(D) = 2;
-  _9 = MEM <struct A> [(struct B *)a_3(D)].elts[i_4(D)].l.len;
-  return _9;
+  return 1;

Reply via email to