(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.c-torture/
execute/
pr88739.c
       1  /* PR tree-optimization/88739 */
       2  #if __SIZEOF_SHORT__ == 2 &&  __SIZEOF_INT__ == 4 && __CHAR_BIT__ == 8
       3  struct A
       4  {
       5    unsigned int a, b, c;
       6    unsigned int d : 30;
       7    unsigned int e : 2;
       8  };
       9  
      10  union U
      11  {
      12    struct A f;
      13    unsigned int g[4];
      14    unsigned short h[8];
      15    unsigned char i[16];
      16  };
      17  volatile union U v = { .f.d = 0x4089 };
      18  
      19  __attribute__((noipa)) void
      20  bar (int x)
      21  {
      22    static int i;
      23    switch (i++)
      24      {
      25      case 0: if (x != v.f.d) __builtin_abort (); break;
      26      case 1: if (x != v.f.e) __builtin_abort (); break;
      27      case 2: if (x != v.g[3]) __builtin_abort (); break;
      28      case 3: if (x != v.h[6]) __builtin_abort (); break;
      29      case 4: if (x != v.h[7]) __builtin_abort (); break;
      30      default: __builtin_abort (); break;
      31      }
      32  }
      33  
      34  void
      35  foo (unsigned int x)
      36  {
      37    union U u;
      38    u.f.d = x >> 2;
      39    u.f.e = 0;
      40    bar (u.f.d);
      41    bar (u.f.e);
      42    bar (u.g[3]);
      43    bar (u.h[6]);
      44    bar (u.h[7]);
      45  }
      46  
      47  int
      48  main ()
      49  {
      50    foo (0x10224);
      51    return 0;
      52  }
      53  #else
      54  int
      55  main ()
      56  {
      57    return 0;
      58  }
      59  #endif