1 /* PR middle-end/92323 - bogus -Warray-bounds after unrolling despite
4 { dg-options "-O2 -Wall" } */
6 struct S
{ int a
[5]; } s
;
10 #pragma GCC optimize "2"
12 void f_O2 (unsigned n
, struct S
*p
)
14 for (unsigned i
= 1; i
< n
- 1; ++i
)
15 s
.a
[i
- 1] = p
->a
[i
]; // { dg-bogus "\\\[-Warray-bounds" }
18 __builtin_unreachable ();
21 void g_O2 (unsigned n
, struct S
*p
)
24 __builtin_unreachable ();
26 for (unsigned i
= 1; i
< n
- 1; ++i
)
31 // Also exercise -O3 with loop unrolling for good measure.
33 #pragma GCC optimize "3"
35 struct T
{ int a
[6]; } t
;
37 void f_O3 (unsigned n
, struct T
*p
)
39 for (unsigned i
= 1; i
< n
- 1; ++i
)
40 t
.a
[i
- 1] = p
->a
[i
]; // { dg-bogus "\\\[-Warray-bounds" }
43 __builtin_unreachable ();
46 void g_O3 (unsigned n
, struct T
*p
)
49 __builtin_unreachable ();
51 for (unsigned i
= 1; i
< n
- 1; ++i
)