1 /* PR tree-optimization/101397 - spurious warning writing to the result
4 { dg-options "-O2 -Wall" } */
6 char* strcpy (char*, const char*);
10 extern char ax
[], a3
[3], a5
[5], *s
;
14 void test_strcpy (int i
)
17 char *p
= strcpy (ax
, s
);
18 x
= p
[-1]; // { dg-warning "\\\[-Warray-bounds" }
24 char *p
= strcpy (a3
, s
);
25 x
= p
[-1]; // { dg-warning "\\\[-Warray-bounds" }
29 x
= p
[3]; // { dg-warning "\\\[-Warray-bounds" }
33 char *p
= strcpy (a5
, s
);
34 x
= p
[-1]; // { dg-warning "\\\[-Warray-bounds" }
35 sink (p
[0], p
[1], p
[2], p
[3], p
[4]);
36 x
= p
[ 5]; // { dg-warning "\\\[-Warray-bounds" }
40 char *p
= strcpy (a5
+ 1, s
);
41 x
= p
[-2]; // { dg-warning "\\\[-Warray-bounds" }
42 sink (p
[-1], p
[0], p
[1], p
[2], p
[3]);
43 x
= p
[4]; // { dg-warning "\\\[-Warray-bounds" }
47 char *p
= strcpy (a5
+ 2, s
);
48 x
= p
[-3]; // { dg-warning "\\\[-Warray-bounds" }
49 sink (p
[-2], p
[-1], p
[0], p
[1], p
[2]);
50 x
= p
[3]; // { dg-warning "\\\[-Warray-bounds" }
54 char *p
= strcpy (a5
+ 3, s
);
55 x
= p
[-4]; // { dg-warning "\\\[-Warray-bounds" }
56 sink (p
[-3], p
[-2], p
[-1], p
[0], p
[1]);
57 x
= p
[2]; // { dg-warning "\\\[-Warray-bounds" }
61 char *p
= strcpy (ax
, a3
);
62 p
[-1] = 1; // { dg-warning "\\\[-Warray-bounds" }
63 sink (p
[0], p
[1], p
[2], p
[9], p
[99]);