summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/vla-24.c
blob: 8b7230584b9abac239b0aa1f698844381c6e1b84 (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
28
29
30
31
32
/* PR middle-end/65958 */

/* { dg-do run } */
/* { dg-options "-std=gnu99" } */
/* { dg-require-effective-target alloca } */

extern void abort (void);

int foo (int n)
{
  char *p, *q;

  if (1)
    {
      char i[n];
      p = __builtin_alloca (8);
      p[0] = 1;
    }

  q = __builtin_alloca (64);
  __builtin_memset (q, 0, 64);

  return !p[0];
}

int main (void)
{
  if (foo (48) != 0)
    abort ();

  return 0;
}