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