1/* { dg-do compile { target c99_runtime } } */
2/* { dg-options "-O2 -fdump-ipa-icf"  } */
3/* { dg-add-options c99_runtime } */
4
5#include <complex.h>
6
7#if (__SIZEOF_INT__ == __SIZEOF_FLOAT__)
8typedef int intflt;
9#elif (__SIZEOF_LONG__ == __SIZEOF_FLOAT__)
10typedef long intflt;
11#else
12#error Add target support here for type that will union float size
13#endif
14
15
16static double test;
17
18struct struktura
19{
20  union
21  {
22    long i;
23    float f;
24  } u;
25};
26
27struct struktura sss;
28
29struct X
30{
31  int i;
32  union
33  {
34    intflt j;
35    intflt k;
36    float f;
37  } u;
38};
39
40__attribute__ ((noinline))
41intflt foo(intflt j)
42{
43  struct X a;
44
45  a.u.j = j;
46  a.u.f = a.u.f;
47  a.u.f = a.u.f;
48  a.u.j = a.u.j;
49  a.u.f = a.u.f;
50  return a.u.k;
51}
52
53__attribute__ ((noinline))
54intflt foo2(intflt j)
55{
56  struct X a;
57
58  a.u.j = j;
59  a.u.f = a.u.f;
60  a.u.f = a.u.f;
61  a.u.j = a.u.j;
62  a.u.f = a.u.f;
63  return a.u.k;
64}
65
66int main()
67{
68  return 1;
69}
70
71/* { dg-final { scan-ipa-dump "Semantic equality hit:foo2->foo" "icf"  } } */
72/* { dg-final { scan-ipa-dump "Equal symbols: 1" "icf"  } } */
73/* { dg-final { cleanup-ipa-dump "icf" } } */
74