(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
tree-ssa/
sra-5.c
       1  /* { dg-do compile } */
       2  /* { dg-options "-O1 -fdump-tree-optimized" } */
       3  
       4  /* Tests for SRA of unions. */
       5  
       6  void link_error (void);
       7  
       8  typedef union testunion
       9  {
      10    double d;
      11    char f1;
      12  } testunion;
      13  
      14  void
      15  copyunion1 (testunion param)
      16  {
      17    testunion local;
      18    param.f1 = 0;
      19    local = param;
      20    if (local.f1 != 0)
      21      link_error ();
      22  }
      23  
      24  void
      25  copyunion11 (testunion *param)
      26  {
      27    testunion local;
      28    param->f1 = 0;
      29    local = *param;
      30    if (local.f1 != 0)
      31      link_error ();
      32  }
      33  
      34  void
      35  copyunion111 (testunion param)
      36  {
      37    testunion *local = &param;
      38    param.f1 = 0;
      39    if (local->f1 != 0)
      40      link_error ();
      41  }
      42  
      43  testunion globuf;
      44  void
      45  copyunion1111 (void)
      46  {
      47    testunion local;
      48    globuf.f1 = 0;
      49    local = globuf;
      50    if (local.f1 != 0)
      51      link_error ();
      52  }
      53  
      54  void
      55  copyunion11111 (void)
      56  {
      57    testunion *local = &globuf;
      58    globuf.f1 = 0;
      59    if (local->f1 != 0)
      60      link_error ();
      61  }
      62  
      63  void
      64  copyunion111111 (testunion param)
      65  {
      66    static testunion local;
      67    param.f1 = 0;
      68    local = param;
      69    if (local.f1 != 0)
      70      link_error ();
      71  }
      72  
      73  /* There should be no reference to link_error. */
      74  /* { dg-final { scan-tree-dump-times "link_error" 0 "optimized"} } */