aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/vla-4.c
blob: 8a7bbac9a7166213cb3f0cb146beba1bb1b93146 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* { dg-do run } */
/* { dg-options "-fsanitize=vla-bound" } */

#include <stdio.h>

int
main (void)
{
  fputs ("UBSAN TEST START\n", stderr);

  int x = 1;
  /* Check that the size of an array is evaluated only once.  */
  int a[++x];
  if (x != 2)
    __builtin_abort ();

  fputs ("UBSAN TEST END\n", stderr);
  return 0;
}

/* { dg-output "UBSAN TEST START(\n|\r\n|\r)UBSAN TEST END" } */