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

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

/* PR sanitizer/65081 */
/* { dg-do run } */
/* { dg-skip-if "" { *-*-* } { "*" } { "-O2" } } */
/* { dg-options "-fsanitize=object-size -fno-sanitize-recover=object-size" } */

struct S
{
  int a;
  char p[1];
};

struct S b;

struct S *
foo ()
{
  struct S *i = &b;
  return i + 1;
}

int
main (void)
{
  struct S *i = foo () - 1;
  i->a = 1;
}