1 /* PR middle-end/82612 - missing -Warray-bounds on a non-zero offset
2 from the address of a non-array object
3 { dg-do compile }
4 { dg-options "-O2 -Wall" } */
5
6 int i;
f0(void)7 int f0 (void)
8 {
9 int *p = &i;
10 return p[2]; // { dg-warning "-Warray-bounds" }
11 }
12
f1(int j)13 int f1 (int j)
14 {
15 int i = j;
16 int *p = &i;
17 return p[2]; // { dg-warning "-Warray-bounds" }
18 }
19
f2(int i)20 int f2 (int i)
21 {
22 int *p = &i;
23 return p[2]; // { dg-warning "-Warray-bounds" }
24 }
25
26 /* { dg-prune-output "-Wuninitialized" } */
27