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