aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/c-c++-common/ubsan/vla-3.c
blob: 7772857fdea95165485c0474480484fd24d5faf9 (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
/* { dg-do run } */
/* { dg-options "-fsanitize=vla-bound" } */

#include <stdio.h>

/* Don't instrument the arrays here.  */
int
foo (int n, int a[])
{
  return a[n - 1];
}

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

  int a[6] = { };
  int ret = foo (3, a);

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

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