>>>>> "Shaun" == Shaun Jackman <[EMAIL PROTECTED]> writes:

 >> 2) Is there padding between the struct members to maintain their
 >> natural alignments (on the assumption that the struct's base
 >> address is aligned.)

 Shaun> There is no padding. The structure is defined as
 Shaun> __attribute__((packed)) to explicitly remove the padding. The
 Shaun> result is that gcc knows the unaligned four byte member is at
 Shaun> an offset of two bytes from the base of the struct, but uses a
 Shaun> four byte load at the unaligned address of base+2. I don't
 Shaun> expect...
 Shaun>          p-> unaligned = n;
 Shaun> ... to work, ...

I would.  If you tell gcc that a thing is unaligned, it is responsible
for doing unaligned references to it.  That very definitely includes
direct references to the content in expressions.  And in general that
works.  Clearly there is a GCC bug here; GCC put the field at an
unaligned offset, but did not do unaligned references to it.

          paul

Reply via email to