1 /* { dg-do compile } */
2 /* { dg-options "-O3 -Warray-bounds" } */
3 
f(unsigned len,int buflen)4 int f(unsigned len, int buflen)
5 {
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 */
11 
12   b[0] = 0;
13   taillen= buflen & 7;    /* taillen [0..7] */
14 
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++;
22       }
23   }
24   return j;
25 }
26