Fix ICE in substring-handling building 502.gcc_r (PR 87562)
[official-gcc.git] / gcc / testsuite / gcc.dg / Warray-bounds-28.c
blobc63c70ad389966843c4e70ed51e6ec01c2eb443d
1 /* PR tree-optimization/48560 - -Warray-bounds fails to detect the out of
2 bound array access
3 { dg-do compile }
4 { dg-options "-O2 -Warray-bounds" } */
6 char foo1 (int i)
8 static char s[] = "foo";
9 switch (i)
11 case 30:
12 return s[30]; /* { dg-warning "array subscript 30 is above array bounds" } */
14 return s[i];