Hi,
we have a problem with struct alignment and size when containing 32 bit members on C2000 compiler (6.4.9):
struct
{
int id;
int count_bytes : 8;
int result : 8;
unsigned long number;
int index : 8;
int type : 8;
} serial_data;
sizeof(serial_data) is given as 6 while I would expect 5.
When replacing unsigned long number by 2 ints, the size is correctly given as 5.
Unfortunately, this is a struct describing a serial data stream, so we are not free in chosing the struct elements.
The stuff word is added at the end of the structure. This is correct if the struct is used as array to provide alignment for the next 32 bit number element, but this does not seem to be necessary for a single struct.
Is there some compiler setting that would prevent this alignment at the end?
Regards,
Stephan