David, Do I read this correctly? Are you truly saying that two structs with identical layout will trigger different code sequences just because one was declared packed? (This is just the sort of thing that drives me crazy when trying to coax a compiler into producing good code.) /john -----Original Message----- From: David Edelsohn [mailto:dje@xxxxxxxxxxxxxx] Sent: Friday, February 03, 2006 11:26 PM To: Yaro Pollak Cc: gcc-help@xxxxxxxxxxx Subject: Re: Unaligned access to packed structs on ppc405 >>>>> Yaro Pollak writes: > If on the other hand I compile: > > Test pt; > return pt.b + pt.c + pt.d; > > lwz 3,8(1) That is an artifact of the example. If I declare "pt" as a global variable, GCC 4.1 prerelease produces three lbz. The lbz has to do with the size and the packed alignment. With the packed structure, GCC chooses the smallest memory access that covers the bitfield. Once GCC has chosen bytes, it cannot merge the loads together. If the structure were not declared packed, GCC would use wider loads with masking, and then determine that the loads refer to the same object. David