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