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

            Bug ID: 127129
           Summary: Incorrect vectorization with -march=x86-64-v2
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kristerw at gcc dot gnu.org
            Blocks: 118443
  Target Milestone: ---

The function glob3 below is miscompiled on x86_64 with -O3 -march=x86-64-v2.
The function as called in the test is supposed to write 1 and 0 to the first
two elements of `a`, but the generated code instead writes 1 to the fist 16
elements, followed by a 0.

__attribute__ ((noipa))
void
glob3 (char *sc, short *dc)
{
  while (dc && (*dc++ = *sc))
    ;
}

int main(void)
{
  short a[64];
  __builtin_memset(a, 1, sizeof(a));
  glob3((char*)a + 1, a);
  if (a[0] != 1 || a[1] != 0 || a[2] != 257)
    __builtin_abort();
  return 0;
}


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118443
[Bug 118443] [Meta bug] Bugs triggered by and blocking more smtgcc testing

Reply via email to