diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/vector-subscript-3.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/vector-subscript-3.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/vector-subscript-3.c b/gcc/testsuite/gcc.dg/vector-subscript-3.c new file mode 100644 index 000000000..55ed2b370 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vector-subscript-3.c @@ -0,0 +1,19 @@ +/* Check the case when index is out of bound */ +/* { dg-do compile } */ +/* { dg-options "-Warray-bounds" } */ + +#define vector __attribute__((vector_size(16) )) + + +int test0(void) +{ + vector int a; + return a[10]; /* { dg-warning "index value is out of bound" } */ +} + +int test1(void) +{ + vector int a; + return a[-1]; /* { dg-warning "index value is out of bound" } */ +} + |