aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.dg/torture/pr39678.c
blob: 5411fbbc1cde6a3dc24da7a335454a7dea158d64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* PR target/39678 */
/* { dg-do run } */
/* { dg-options "-Wno-psabi" } */

struct X {
  signed char c;
  __complex__ float val;
};

struct X __attribute__((noinline))
foo (float *p)
{
  struct X x;
  x.c = -3;
  __real x.val = p[0];
  __imag x.val = p[1];
  return x;
}
extern void abort (void);
float a[2] = { 3., -2. };
int main()
{
  struct X x = foo(a);
  if (x.c != -3 || __real x.val != a[0] || __imag x.val != a[1])
    abort ();
  return 0;
}