summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/tree-ssa/pr34063.C
blob: 994920bb923fdfbac9f74c1e79f7e7f4aef72107 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// { PR tree-optimization/34063 }
// { dg-do compile }
// { dg-options "-O2" }

struct S
{
  double e[9];

  double const &
  operator() (int r, int c) const
  {
    return e[r * 3 + c];
  }
};

void
foo()
{
  S r;
  double *p;
  for (int j = 0; j < 3; j++)
    for (int k = 0; k < 3; k++)
      for (int l = k + 1; l < 3; l++)
        *p++ = r (k, 0) * r (l, j) + r (k, j) * r (l, 0);
}