aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/ubsan/bounds-10.c
blob: a6187b543e89bdeef2dacbce3ab9e95d018493cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/* { dg-do run } */
/* { dg-options "-fsanitize=bounds-strict" } */

struct V { int l; int a[1]; };

int
main (void)
{
  /* For strict, do instrument last array in a struct.  */
  struct V *v = (struct V *) __builtin_malloc (sizeof (struct V) + 10);
  v->a[1] = 1;

  return 0;
}

/* { dg-output "index 1 out of bounds for type 'int \\\[1\\\]'" } */