Problem with structure alignment on MPC

Daniel Lidsten Daniel.Lidsten@combitechsystems.com
Wed May 7 15:28:00 GMT 2003


Hi,

I want to align my structure so that they always is allocated with a
16bit alignment

If i specify a structure like this:

struct block {
	unsigned short next;
	union {
		int size;
		char data[4];
	} file ;
	char datalast ;
	char chs ;
  	char chs2 ;
  	

} __attribute__(( aligned(2), packed ));

...then all structures get 16bit aligned if i allocated them as an array
like this:

struct block test[10];

BUT, if i allocate them one by one:

struct block test1;
struct block test1;
struct block test1;

....then i get a structure alignment of 8byte

Why is that? Is there some compiler flag that i can use to make the
compiler to always use 16bit alignment between varaibles/structures?

Regards, Daniel

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



More information about the crossgcc mailing list