builtin-has-attribute-4.c: Skip on 32-bit hppa*-*-hpux*.
[official-gcc.git] / gcc / testsuite / gcc.dg / Warray-bounds-10.c
blob5fd6e6f1a91ab7ac68358e8f4da18ba079d521b6
1 /* { dg-do compile } */
2 /* { dg-options "-O3 -Warray-bounds" } */
4 int f(unsigned len, int buflen)
6 unsigned taillen;
7 unsigned slen;
8 unsigned i;
9 int b[17]; /* needed <= 17 to trigger Warning */
10 int j = 0; /* needed to trigger Warning */
12 b[0] = 0;
13 taillen= buflen & 7; /* taillen [0..7] */
15 if(taillen) { /* taillen [1..7] */
16 slen= 8 - taillen; /* slen [7..1] */
17 if (len<slen) /* needed to trigger Warning */
18 slen=len; /* slen' < slen */
19 for(i=0; i<slen; i++) {
20 j = b[taillen]; /* taillen + slen = [1..7] + [7..1] = 8 */
21 taillen++;
24 return j;