public inbox for crossgcc@sourceware.org
 help / color / mirror / Atom feed
* packed attribute under m68k and :0...
@ 2000-06-05 14:07 Stephane Dalton
  0 siblings, 0 replies; only message in thread
From: Stephane Dalton @ 2000-06-05 14:07 UTC (permalink / raw)
  To: crossgcc

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-06-05 14:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-05 14:07 packed attribute under m68k and :0 Stephane Dalton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).