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

            Bug ID: 114075
           Summary: [14 Regression] s390x miscompilation since r14-322
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

Since r14-322-g821ef93976e750c118d42a2ad33b96dbd1b9f3a5 the following testcase
is miscompiled at -O2 -fopenmp-simd -march=z13 on s390x-linux:
typedef float V __attribute__((__vector_size__ (16)));

__attribute__((__always_inline__)) inline static float
foo (V a)
{
  float r = 0;
#pragma omp simd reduction(+:r)
  for (unsigned long i = 0; i < (sizeof (a) / sizeof (float)); i++)
    r += a[i];
  return r;
}

int
main ()
{
  static const struct { V a; float r; } t[] = {
    { (V) { -654.47f, -946.98f, -606.16f, 426.64f }, -1780.97f },
    { (V) { 663.94f, 660.23f, 682.64f, -644.47f }, 1362.34f },
    { (V) { -909.10f, 23.60f, -382.13f, -563.57f }, -1831.20f }
  };
  for (unsigned long i = 0; i < (sizeof (t) / sizeof (t[0])); i++)
    {
      float r = foo (t[i].a);
      if (r < t[i].r - 1.0f || r > t[i].r + 1.0f)
        __builtin_abort ();
    }
}

Before that change, all the 3 results were correct, now all of them are +-0.0f.

Reply via email to