Merge from branches/gcc-4_8-branch up to rev 207411.
[official-gcc.git] / gcc-4_8-branch / gcc / testsuite / g++.dg / ext / attribute-test-1.C
blob93e08d7ef897e5ecb32b0657fc4d01493cb16c6c
1 // { dg-do run }
2 // { dg-options "" }
3 // PR c++/13989
5 extern "C" void abort();
7 #define vector __attribute__((vector_size(16)))
9 struct Constants {
10    inline vector unsigned int deadbeef(void) const {
11        return (vector unsigned int){0xdeadbeef, 0xabababab, 0x55555555, 0x12345678};
12    };
15 inline vector unsigned int const_deadbeef(Constants &C)
17   return C.deadbeef();
20 union u {
21               unsigned int f[4];
22               vector unsigned int v;
23 } data;
25 int main()
27   Constants c;
28   data.v = const_deadbeef(c);
29   
30   if (data.f[0] != 0xdeadbeef || data.f[1] != 0xabababab 
31       || data.f[2] != 0x55555555 || data.f[3] != 0x12345678)
32     abort();
34   return 0;
37 /* Ignore a warning that is irrelevant to the purpose of this test.  */
38 /* { dg-prune-output ".*GCC vector returned by reference.*" } */
39 /* { dg-prune-output "changes the ABI" } */