view gcc/testsuite/c-c++-common/ubsan/bounds-4.c @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 04ced10e8804
children
line wrap: on
line source

/* { 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;
}