modernc.org/ccgo/v3@v3.16.14/lib/testdata/gcc-9.1.0/gcc/testsuite/gcc.c-torture/execute/pr86492.c (about)

     1  /* PR tree-optimization/86492 */
     2  
     3  union U
     4  {
     5    unsigned int r;
     6    struct S
     7    {
     8      unsigned int a:12;
     9      unsigned int b:4;
    10      unsigned int c:16;
    11    } f;
    12  };
    13  
    14  __attribute__((noipa)) unsigned int
    15  foo (unsigned int x)
    16  {
    17    union U u;
    18    u.r = 0;
    19    u.f.c = x;
    20    u.f.b = 0xe;
    21    return u.r;
    22  }
    23  
    24  int
    25  main ()
    26  {
    27    union U u;
    28    if (__CHAR_BIT__ * __SIZEOF_INT__ != 32 || sizeof (u.r) != sizeof (u.f))
    29      return 0;
    30    u.r = foo (0x72);
    31    if (u.f.a != 0 || u.f.b != 0xe || u.f.c != 0x72)
    32      __builtin_abort ();
    33    return 0;
    34  }