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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Reduced testcase with -Ofast:
template <int N> struct C {
  typedef int D[N];
  static int &foo (D x, int y) { return x[y]; }
};
template <typename, int N> struct A {
  typedef C<N> H;
  typename H::D k;
  int &operator[](long x) { return H::foo (k, x); }
};
template <typename T> void bar (T);

float v;

int
main ()
{
  constexpr int n = 1 << 8;
  A<float, n> o;
  auto load = [&](int i, float q) { o[i] = q;
                                    for (int j = 1; j < 8; ++j)
                                      o[i + j] = o[i + j - 1]; };
  for (float p = v; p;)
    for (auto j = 0; j < n; j += 8)
      {
        p += 4.e7f;
        load (j, p);
      }
  bar (o);
}

Reply via email to