1 /* { dg-do compile } */
2 /* { dg-options "-O2 -Warray-bounds" } */
6 static inline int n(void) {
7 __SIZE_TYPE__ strlen(const char *s);
8 return strlen("12345");
21 a[-1] = 0; /* { dg-warning "array subscript" } */
27 a[10] = 0; /* { dg-warning "array subscript" } */
28 a[11] = 0; /* { dg-warning "array subscript" } */
29 a[2 * n() - 11] = 0; /* { dg-warning "array subscript" } */
32 a[2 * n() - 0] = 0; /* { dg-warning "array subscript" } */
34 b[-1] = 0; /* { dg-warning "array subscript" } */
38 b[10] = 0; /* { dg-warning "array subscript" } */
39 b[11] = 0; /* { dg-warning "array subscript" } */
40 b[2 * n() - 11] = 0; /* { dg-warning "array subscript" } */
43 b[2 * n() - 0] = 0; /* { dg-warning "array subscript" } */
45 c.c[-1] = 0; /* { dg-warning "array subscript" } */
49 c.c[10] = 0; /* { dg-warning "array subscript" } */
50 c.c[11] = 0; /* { dg-warning "array subscript" } */
51 c.c[2 * n() - 11] = 0; /* { dg-warning "array subscript" } */
52 c.c[2 * n() - 10] = 0;
54 c.c[2 * n() - 0] = 0; /* { dg-warning "array subscript" } */
59 g(&a[11]); /* { dg-warning "array subscript" } */
60 g(&a[-30]+10); /* { dg-warning "array subscript" } */
65 g(&a[11]); /* { dg-warning "array subscript" } */
66 g(&b[11]); /* { dg-warning "array subscript" } */
67 g(&c.c[11]); /* { dg-warning "array subscript" } */
73 g(&a[-1]); /* { dg-warning "array subscript" } */
74 g(&b[-1]); /* { dg-warning "array subscript" } */