Mercurial > hg > CbC > CbC_gcc
annotate gcc/testsuite/gcc.dg/Warray-bounds-28.c @ 158:494b0b89df80 default tip
...
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 25 May 2020 18:13:55 +0900 |
parents | 84e7813d76e9 |
children |
rev | line source |
---|---|
131 | 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" } */ | |
5 | |
6 char foo1 (int i) | |
7 { | |
8 static char s[] = "foo"; | |
9 switch (i) | |
10 { | |
11 case 30: | |
12 return s[30]; /* { dg-warning "array subscript 30 is above array bounds" } */ | |
13 } | |
14 return s[i]; | |
15 } |