This is the mail archive of the gcc-bugs@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: memcpy() inlining and alignment


On Fri, 3 Mar 2000 16:25:35 -0800 
 "David S. Miller" <davem@redhat.com> wrote:

 > I believe the compiler is correctly assuming that the structure is
 > aligned to whatever alignment is required by the members of the
 > structure type for a particular processor's ABI.  In this case, most
 > likely the required alignment is 4 bytes on 32-bit systems.
 > 
 > If this is the case, you'll need to create your own
 > "memcpy_unaligned()" or similar interface for these specific
 > cases.

I'm not sure I buy that.  What you're effectively saying is:

	There is no standard function in C that allows unaligned
	data to be copied into an aligned buffer.

Personally, I have never encountered a libc implementation of memcpy()
that required data to be aligned in the way you're suggesting.

	-- Jason R. Thorpe <thorpej@netbsd.org>


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