aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/ubsan/bounds-4.c
blob: 88e7e14050ecd5ebc2572d097b50539d0ce9cd95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/* { dg-do compile } */
/* { dg-options "-fsanitize=bounds -Wall -Wextra -Wno-array-bounds -Wno-unused" } */

/* Initializers of TREE_STATICs aren't instrumented.
   But don't ICE on 'em.  */

int A[2];
int *gp = &A[4];
int *gpi;

int
main (void)
{
  gpi = &A[4]; /* This will warn with -Warray-bounds, but only if VRP runs.  */
  static int *pi = &A[4];
  return 0;
}