aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr99122-2.c
blob: c0c850f141cde0bb8ac0615262828eda61566fd7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* { dg-do compile } */
/* { dg-options "-O2 -g -w" } */
/* { dg-require-effective-target alloca } */

static int foo ();

int
bar (int n)
{
  struct S { char a[n]; } x;
  __builtin_memset (x.a, 0, n);
  return foo (n, x);
}

static inline int
foo (int n, struct T { char a[n]; } b)
{
  int r = 0, i;
  for (i = 0; i < n; i++)
    r += b.a[i];
  return r;
}