OSDN Git Service

PR tree-optimization/52019
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / vector-init-2.c
1 /* { dg-do run } */
2
3 /* PR C/31499, test that the C front-end treats vectors like an array
4    and that it works at runtime. */
5
6 #define vector __attribute__((__vector_size__(4*sizeof(int)) ))
7 vector signed int v1[]={0,1,2,3,4,5,6,7};
8
9
10 int main(void)
11 {
12   int i;
13   for (i = 0; i < sizeof(v1)/sizeof(v1[0]); i++)
14   {
15     vector int t = v1[i];
16     int *d = (int*)&t;
17     int j;
18     for (j = 0; j < 4; j++)
19       {
20         if (d[j] != i * 4 + j)
21           __builtin_abort ();
22       }
23   }
24   return 0;
25 }