This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


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

Re: misaligned access


> Date: Wed, 13 Dec 2000 11:09:30 -0600
> From: Davy Durham <david.durham@wcom.com>
> To: gcc@gcc.gnu.org

> And I can point a foo * anywhere to any address not aligned i.e.
> anywhere in the buffer'o'data... And I don't get a bus error on
> sparc.... I tested it..

The only issue, which I am sure you already know about, but I mention
it for others that might not know, packing does change the structure
layout, so you have to be sure the start address of each element you
want to get at, is at the right place.

Also, you could also memcpy to a suitably aligned location, and then
use it out of there.  And last, ABI compatibility across platforms
with structures can be problematic (non-portable).  gcc needs a way to
have a machine and platform independent layout format and expose that
to the C programmer.  Programmers already do this, and already expect
it to work.  :-(

Thanks for sharing your solution.

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