view gcc/testsuite/gcc.dg/Warray-bounds-15.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

/* { dg-do compile } */
/* { dg-options "-O2 -Warray-bounds" } */

int a[10];
int *foo1 (int i)
{
  return &a[10]; /* { dg-bogus "above array bounds" } */
}
int *foo2 (int i)
{
  return &a[11]; /* { dg-warning "above array bounds" } */
}
int foo3 (int i)
{
  return a[9]; /* { dg-bogus "above array bounds" } */
}
int foo4 (int i)
{
  return a[10]; /* { dg-warning "above array bounds" } */
}