1 /* PR middle-end/36902 Array bound warning with dead code after optimization */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -Warray-bounds -Wall -Wextra" } */
4 typedef unsigned char __u8;
5 typedef unsigned short __u16;
7 static inline unsigned char *
8 foo(unsigned char * to, const unsigned char * from, int n)
24 unsigned char pcr_select[4];
29 static unsigned char buf[64];
31 sel.size_of_select = 3;
32 foo(buf, sel.pcr_select, sel.size_of_select);
38 static inline unsigned char *
39 foo2(unsigned char * to, const unsigned char * from, int n)
47 to[4] = from [4]; /* { dg-warning "20:array subscript is above array bounds" } */
55 static unsigned char buf[64];
57 sel.size_of_select = 5;
58 foo2(buf, sel.pcr_select, sel.size_of_select);