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

            Bug ID: 80170
           Summary: SLP vectorization creates aligned access
           Product: gcc
           Version: 7.0.1
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

While playing with some unrelated area I noticed a latent bug in the vectorizer
mishandling alignment for which I only have a gimple testcase sofar, reduced
from g++.dg/torture/pr78189.C:

struct  A
{
  void * a;
  void * b;
};

struct __attribute__((aligned(16))) B
{
  void * pad;
  void * misaligned;
  void * pad2;

  struct A a;
};

__attribute__((noclone, noinline))
void __GIMPLE (startwith("slp"))
NullB (void * misalignedPtr)
{
  struct B * b;

  bb_2:
  b_2 = misalignedPtr_1(D) + 18446744073709551608ul;
  __MEM <struct B> (b_2).a.a = _Literal (void *) 0;
  __MEM <struct B> (b_2).a.b = _Literal (void *) 0;
  return;

}

int main()
{
  struct B b;
  NullB (&b.misaligned);
  return 0;
}

> gcc-7 t.c -fgimple -O2 -ftree-slp-vectorize
> ./a.out
Segmentation fault (core dumped)

Reply via email to