gcc/testsuite/g++.dg/torture/pr39678.C
raw| 1 | /* PR target/39678 */ |
| 2 | /* { dg-do run } */ |
| 3 | /* { dg-options "-Wno-psabi" } */ |
| 4 | struct Y {}; |
| 5 | struct X { |
| 6 | struct Y y; |
| 7 | __complex__ float val; |
| 8 | }; |
| 9 | |
| 10 | struct X __attribute__((noinline)) |
| 11 | foo (float *p) |
| 12 | { |
| 13 | struct X x; |
| 14 | __real x.val = p[0]; |
| 15 | __imag x.val = p[1]; |
| 16 | return x; |
| 17 | } |
| 18 | extern "C" void abort (void); |
| 19 | float a[2] = { 3., -2. }; |
| 20 | int main() |
| 21 | { |
| 22 | struct X x = foo(a); |
| 23 | if (__real x.val != 3. || __imag x.val != -2.) |
| 24 | abort (); |
| 25 | return 0; |
| 26 | } |