view gcc/testsuite/gcc.dg/Warray-bounds-15.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
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" } */
}