summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/torture/pr39678.C
blob: a7c120ad4db76477e4c1b375a6f24e5ed0de2ca4 (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
/* PR target/39678 */
/* { dg-do run } */
/* { dg-options "-Wno-psabi" } */
struct Y {};
struct X {
  struct Y y;
  __complex__ float val;
};

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