LWG 3035. std::allocator's constructors should be constexpr
[official-gcc.git] / gcc / testsuite / gcc.dg / Warray-bounds-14.c
blobf3a33f9c7db3f648e01d61b8390d168726bd74ac
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -Warray-bounds" } */
4 int a[10];
5 int foo1 (int i)
7 if (i < 0 || i > 9)
8 return a[i]; /* { dg-warning "outside array bounds" } */
9 return 0;
11 int foo2 (int i)
13 if (i < 0 || i > 8)
14 return a[i]; /* { dg-bogus "outside array bounds" } */
15 return 0;
17 int *foo3 (int i)
19 if (i < 0 || i > 10)
20 return &a[i]; /* { dg-warning "outside array bounds" } */
21 return (void *)0;
23 int *foo4 (int i)
25 if (i < 0 || i > 9)
26 return &a[i]; /* { dg-bogus "outside array bounds" } */
27 return (void *)0;