aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/pr50290.c
blob: 47680fd9a72cb1791095f6528d26fe65b7784d7a (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
26
27
/* PR rtl-optimization/50290 */
/* { dg-do run } */
/* { dg-options "-O2 -fno-tree-loop-optimize -fno-tree-vrp -funroll-loops" } */

static int
bar (int t[], int b)
{
  int i;
  for (i = 0; i < b; i++)
    t[i] = i + (i > 0 ? t[i - 1] : 0);
  return t[b - 1];
}

static int
foo (int b)
{
  int x[b];
  return bar (x, b);
}

int
main ()
{
  if (foo (6) != 15)
    __builtin_abort ();
  return 0;
}