modernc.org/cc@v1.0.1/testdata/gcc-6.3.0/gcc/testsuite/gcc.c-torture/execute/bitfld-7.c (about)

     1  union U
     2  {
     3    const int a;
     4    unsigned b : 24;
     5  };
     6  
     7  static union U u = { 0x12345678 };
     8  
     9  /* Constant folding used to fail to account for endianness when folding a
    10     union.  */
    11  
    12  int
    13  main (void)
    14  {
    15  #ifdef __BYTE_ORDER__
    16  #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
    17    return u.b - 0x345678;
    18  #else
    19    return u.b - 0x123456;
    20  #endif
    21  #endif
    22    return 0;
    23  }