summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr36504.c
blob: dbcf76648bf89aebd5c2968ff6407621eef6db0e (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/36504 */
/* { dg-do compile } */
/* { dg-options "-O3 -fprefetch-loop-arrays -w" } */

struct A { struct { int a; } b[8]; };
struct B { int c; int d; };
struct C { struct B d; };

void bar (struct C *, int);

struct B
foo (struct C *p, struct A *e, int b)
{
  struct B q;
  bar (p, e->b[b].a);
  return q;
}

void
baz (int b, struct A *e)
{
  struct C p;
  for (; b; ++b)
    p.d = foo (&p, e, b);
}