view gcc/testsuite/c-c++-common/ubsan/bounds-12.c @ 152:2b5abeee2509

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents 04ced10e8804
children
line wrap: on
line source

/* { dg-do run } */
/* { dg-options "-fsanitize=bounds" } */

struct S
{
  unsigned long a[1];
  int l;
};

static inline unsigned long
fn (const struct S *s, int i)
{
  return s->a[i] << i;
}

int
main ()
{
  struct S s;
  fn (&s, 1);
}

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