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

int
main (void)
{
  int *t = (int *) __builtin_malloc (sizeof (int) * 10);
  int (*a)[1] = (int (*)[1]) t;
  (*a)[2] = 1;
}

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