gcc/testsuite/c-c++-common/vector-subscript-3.c
raw| 1 | /* Check the case when index is out of bound */ |
| 2 | /* { dg-do compile } */ |
| 3 | /* { dg-options "-Warray-bounds" } */ |
| 4 | |
| 5 | #define vector __attribute__((vector_size(16) )) |
| 6 | |
| 7 | |
| 8 | int test0(void) |
| 9 | { |
| 10 | vector int a; |
| 11 | return a[10]; /* { dg-warning "index value is out of bound" } */ |
| 12 | } |
| 13 | |
| 14 | int test1(void) |
| 15 | { |
| 16 | vector int a; |
| 17 | return a[-1]; /* { dg-warning "index value is out of bound" } */ |
| 18 | } |