This is the mail archive of the crossgcc@sourceware.cygnus.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more infromation.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

packed attribute under m68k and :0...


Hi there,

I'm using m68k-elf gcc and I have a question about the use of the :0
delimiter in bitfields. Here's an example of the problem I experimented.

typedef unsigned char Uint8;

typedef struct
{
	Uint8 test1:1;
	Uint8 test2:2;
	Uint8 test3:3;
	Uint8 test4:1;
	Uint8 :0;
} __attribute__ {{packed}} test_struct;

Using this and gdb-4.18 if I type p sizeof(test_struct) I get 2.... it means
that this struct is two bytes long which is obviously not what I want.  I've
read the related section about bitfields in ANSI C, and I found that this
kind of construct is supposed to allocated a new Uint8 if and only if this
something following it.

Is it a bug in gcc or do I misunderstand something...

Thanks

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]