------- Comment #1 from pinskia at gcc dot gnu dot org 2008-08-13 21:26 ------- > struct X { uint32_t a:17; uint8_t b:8; bool c:1; }; 0...16 is a as uint32_t is more than 17 bytes 17...24 is b as uint8_t is 8 bytes 25...26 is c as bool is 1 byte
so 26bits which is a little over 4 bytes. so it needs to be rounded (aligned) to 4 byte so we get 8 bytes. I don't see what the issue here is. if we replace uint32_t with uint16_t, the sizes are reduced as it only stores 16 bytes and the alignment of the struct becomes 2 byte aligned. Why do you think the original struct should be 4 bytes? I cannot count how it could ever be 4 bytes really except for replacing of uint32_t with uint16_t. -- pinskia at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |WAITING http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37119