Fix ICE in substring-handling building 502.gcc_r (PR 87562)
[official-gcc.git] / gcc / testsuite / gcc.dg / Wchar-subscripts-1.c
blob3f5adeb31d175116d5884acd4fce2f56265b09ac
1 /* Test -Wchar-subscripts. */
2 /* Origin: Joseph Myers <joseph@codesourcery.com> */
3 /* { dg-do compile } */
4 /* { dg-options "-Wchar-subscripts" } */
6 extern int a[];
7 int *p;
8 char c;
9 signed char sc;
10 unsigned char uc;
12 void
13 f (void)
15 a[sc];
16 a[uc];
17 sc[a];
18 uc[a];
19 p[sc];
20 p[uc];
21 sc[p];
22 uc[p];
23 a[c]; /* { dg-warning "array subscript has type 'char'" } */
24 p[c]; /* { dg-warning "array subscript has type 'char'" } */
25 /* -Wchar-subscripts does not warn if the char is not syntactically
26 the subscript. */
27 c[a];
28 c[p];