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__) 8 typedef int intflt; 9 #elif (__SIZEOF_LONG__ == __SIZEOF_FLOAT__) 10 typedef long intflt; 11 #else 12 #error Add target support here for type that will union float size 13 #endif 14 15 16 static double test; 17 18 struct struktura 19 { 20 union 21 { 22 long i; 23 float f; 24 } u; 25 }; 26 27 struct struktura sss; 28 29 struct X 30 { 31 int i; 32 union 33 { 34 intflt j; 35 intflt k; 36 float f; 37 } u; 38 }; 39 40 __attribute__ ((noinline)) foo(intflt j)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)) foo2(intflt j)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 main()66int main() 67 { 68 return 1; 69 } 70 71 /* { dg-final { scan-ipa-dump "Semantic equality hit:foo->foo2" "icf" } } */ 72 /* { dg-final { scan-ipa-dump "Equal symbols: 1" "icf" } } */ 73