Merge from mainline (gomp-merge-2005-02-26).
[official-gcc.git] / gcc / testsuite / g++.dg / ext / attribute-test-1.C
blob95983cef7cc012b6e0e1f6bd8b873e5eb3630f16
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 { // { dg-warning "vector returned by ref" "" { target { powerpc*-*-linux* && ilp32 } } }
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;