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

--- Comment #4 from Alexander Monakov <amonakov at gcc dot gnu.org> ---
Slightly reduced testcase that demonstrates the issue regardless of
stack-protector; -O3 -ffast-math is enough on x86-64 (plus -msse2 on i386).

Oddly, the #if0 block makes a difference.

static const float A[10] = {1};
#if 0
static
__attribute__((noinline,noclone))
#endif
float
foo(float *f, int n)
{
  int i, j;
  float a = 0, b = 0;
  for (i = n/2; i < n; i++)
    a += f[i]*.1f;
  for (i = n/2, j = 0; i < n; i++, j++)
    b += f[i]*A[j]+a*A[j];
  return b;
}

int main()
{
  float a[21] = {0};
  return foo(a+1, 20) + foo(a, 20);
}

Reply via email to