summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/Warray-bounds-15.c
blob: f50e5ee7cf334c0629ec78c82033dae94aa189c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/* { 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" } */
}