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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |NEW
         Resolution|DUPLICATE                   |---

--- Comment #7 from Martin Sebor <msebor at gcc dot gnu.org> ---
The root cause in this case or the solution are not the same as in bug 94675. 
The MEM_REF type is the type of the access, so it's correct to rely on it for
the size of the access.  The problem here is that the first MEM_REF pointer
operand doesn't point to the actual destination of the access: it points to one
member of the struct but as a result of adding the offset to it the access is
actually to the subsequent member.  It's as if the final store in valid code
like this:

  struct S { char i; char a[8], b[8]; };

  void g (struct S *p)
  {
    typedef __attribute__ ((vector_size (8))) char V;

    char *pa = p->a + 8;
    char *pb = p->b;

    *(V*)pb = (V) {0};   // pb points to p->b
  }

were transformed into:

  pa_2 = &MEM <char[8]> [(void *)p_1(D) + 9B];
  MEM[(V *)pa_2] = { 0, 0, 0, 0, 0, 0, 0, 0 };   // but here store is into
(p->a + 9)

Reply via email to