1 union U 2 { 3 const int a; 4 unsigned b : 20; 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 main(void)13main (void) 14 { 15 #ifdef __BYTE_ORDER__ 16 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ 17 return u.b - 0x45678; 18 #else 19 return u.b - 0x12345; 20 #endif 21 #endif 22 return 0; 23 } 24