gcc/testsuite/gcc.dg/Warray-bounds-12.c
raw| 1 | /* { dg-do compile } */ |
| 2 | /* { dg-options "-O3 -Warray-bounds" } */ |
| 3 | /* { dg-additional-options "-mssse3" { target x86_64-*-* i?86-*-* } } */ |
| 4 | |
| 5 | void foo(short a[], short m) |
| 6 | { |
| 7 | int i, j; |
| 8 | int f1[10]; |
| 9 | short nc; |
| 10 | |
| 11 | nc = m + 1; |
| 12 | if (nc > 3) |
| 13 | { |
| 14 | for (i = 0; i <= nc; i++) |
| 15 | { |
| 16 | f1[i] = f1[i] + 1; |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | for (i = 0, j = m; i < nc; i++, j--) |
| 21 | { |
| 22 | a[i] = f1[i]; /* { dg-bogus "above array bounds" } */ |
| 23 | a[j] = i; |
| 24 | } |
| 25 | return; |
| 26 | } |