Ethereal-dev: Re: [ethereal-dev] memcpy problem

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <guy@xxxxxxxxxx>
Date: Fri, 28 Jul 2000 15:06:05 -0700 (PDT)
> Well, as picky as the Sparc architecture is about byte alignment, it really
> doesn't care when you're only doing a copy.  It just cares if you try to
> reference the data as a long, short, etc.

...which you might be doing if you're doing a copy; if you're copying
something you *know* is aligned, to a destination you *know* is aligned
- which the compiler might know if it's generating code for
"memcpy()"/"memmove()", as those are part of the ANSI C standard and can
be implemented as builtins, and GCC does that - the compiler could do
that with "ldd"/"std" instructions.

If the compiler is confused, however, and thinks it's good enough that
the destination is aligned - which might be the case if you're copying
to a structure on the stack, as I suspect may be the case in the code
that was blowing up - it might generate "ldd"/"std" code for a source
not known to be aligned, which would be the case if the code is copying
from somewhere in the packet buffer.